I'm just beginning to dip my toes into cryptography and a friend has proposed a cipher and challenged me to figure out how to attack it. I know the process used to encrypt, but am having a hard time wrapping my head around a way to go about attacking it.
The cipher is a simple substitution cipher (26 characters possible, each character directly mapping to one other character) and the text is evidently plain ole English. The complicating (at least to me) factor is that in his process he performs this substitution N times where N is the index of the character.
ex. plain text = "test" alphabet = "abcdefghijklmnopqrstuvwxyz" key = "bdfhjlnprtvxzywusqomkigeca" (permutation of alphabet) plain = 't' (1st char subs 0 times, so remains 't') plain = 'e' -> 'j' (2nd char subs 1 time, becomes 'j') plain = 's' -> 'o' -> 'w' (3rd char subs 2 times, becomes 'w') plain = 't' -> 'm' -> 'z' -> 'a' (4th char subs 3 times, becomes 'a') encoded = "tjwa"
Does this cipher have a name? I'm having a hard time finding one online if it does.
As for attacking it, he has given me a large encoded string (100k+ chars). I wrote up a simple Java program to perform encode/decode given a known key, but 26! keys are too many to brute force. So I looked at the letter frequency and noted that a single letter (in my case 'x') appears a disproportionately low number of times (much closer to it's expected English frequency the the other characters), which leads me to believe that perhaps it maps to itself. But obviously that would still leave 25! keys.
I'm genuinely interested in figuring out other techniques to attack this, and am not asking for a single simple solution, but does anyone have any ideas of other ways to go about attacking it? I know the first letter of the plain text, and possibly the positions of a single other letter, but possible "cycles" or "loops" (sorry, I don't know if there's a better word for this) within the key (a->b->c->a) are thus far stumping me as to how to attack it. I at first thought I'd know every 26th character, but that would only be true if there were no "cycles" created by the key.
Any help/direction/pointers/suggestions would be appreciated. Thanks.