From 4ddcedb5d6e3e2b02af41a9ea0af31ed15d752d6 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Wed, 12 Feb 2020 15:21:36 +0100 Subject: [PATCH] Adding scripts/generate-dict.sh --- scripts/generate-dict.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 scripts/generate-dict.sh diff --git a/scripts/generate-dict.sh b/scripts/generate-dict.sh new file mode 100755 index 0000000..e0f2faf --- /dev/null +++ b/scripts/generate-dict.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Generates a dictionary file for usage with eosio-keygen +# - input is read from stdin and should have words separated by newline. +# - output is written to stdout. + +BASE58_ALPHABET=123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz + +# 1. Remove any line that contains non base58 characters +# 2. Remove lines that are 2 or less characters long +# 3. Convert to lowercase +# 4. Sort and remove duplicate lines. +LC_CTYPE=C awk "! /[^${BASE58_ALPHABET}]/" < /dev/stdin 2> /dev/null \ + | sed -r '/^.{,2}$/d' \ + | tr '[:upper:]' '[:lower:]' \ + | sort | uniq -d