Identifying a substitution cipher random key. (English text)
input: Crypted English normal text (A-Z) using a random generated substitution cip开发者_JAVA技巧her.
output: key
ideas: read the whole text storing in some arrays the frequencies for each character/bigram/trigram and comparing them to:
http://en.wikipedia.org/wiki/Letter_frequencies http://en.wikipedia.org/wiki/Bigram http://en.wikipedia.org/wiki/Trigramcons: letters/bigrams/trigrams with close percentage (like "c" and "u")
my software should be able to guess the max. possible characters from the crypted text (minimum 2000 characters).
I have to guess at least 18-20 letters.questions:
is there a way/known algorithm to guess all the characters => full key ? or can you give me some useful references or advices on how I could improve the whole guessing process ?I think you're on the right track. The only way you could recover the full key would be if the all characters (or all-1) are present in the plain text.
I'd be thinking along the lines of making some statistical guesses and then statictically checking the results for the plaintext Bigrams/Trigrams which result. Or checking whole words (if you know where the word boundaries are) against a word list.
精彩评论