diff --git a/dict.sh b/dict.sh new file mode 100755 index 0000000000000000000000000000000000000000..d701dae5881440402d00752bce7da7fe76b22401 --- /dev/null +++ b/dict.sh @@ -0,0 +1,29 @@ +#! /bin/bash + +cat /usr/share/dict/brazilian | \ +conv -f ISO8859-1 -t UTF8 | \ +sed -e 's/â/a/g' | \ +sed -e 's/ã/a/g' | \ +sed -e 's/á/a/g' | \ +sed -e 's/à /a/g' | \ +sed -e 's/é/e/g' | \ +sed -e 's/ê/e/g' | \ +sed -e 's/Ã/i/g' | \ +sed -e 's/ó/o/g' | \ +sed -e 's/ô/o/g' | \ +sed -e 's/õ/o/g' | \ +sed -e 's/ú/u/g' | \ +sed -e 's/Â/A/g' | \ +sed -e 's/Ã/A/g' | \ +sed -e 's/Ã/A/g' | \ +sed -e 's/À/A/g' | \ +sed -e 's/É/E/g' | \ +sed -e 's/Ê/E/g' | \ +sed -e 's/Ã/I/g' | \ +sed -e 's/Ó/O/g' | \ +sed -e 's/Ô/O/g' | \ +sed -e 's/Õ/O/g' | \ +sed -e 's/Ú/U/g' | \ +tr [A-Z] [a-z] | \ +egrep .... | \ +egrep -v ....... > dict.txt diff --git a/playfair.cpp b/playfair.cpp index af02bed83d70c1de37db0cfe19e6e76dbe441866..35bd6202a38ee70f6064f3ebbeebc00ccebb4b13 100644 --- a/playfair.cpp +++ b/playfair.cpp @@ -40,7 +40,10 @@ std::string playfair(std::string text, const std::string key, int crypt){ } unsigned int indexT = 0; while(indexT <text.size() ){ + + while(text[indexT] < 'a' || text[indexT] > 'z') ++indexT; char fst = text[indexT]; + while(text[indexT] < 'a' || text[indexT] > 'z') ++indexT; char snd = (++indexT< text.size())?text[indexT]:'x'; ++indexT; if (fst == snd){