This looks very interesting. The only time I've ever come across these ciphers is as part of a crossword; a typical example would be where the solutions to some half a dozen marked clues need to be enciphered before entry into the grid, using some keyword to be determined (by looking at the checking letters, and spotting a connection with thematic elements).
Of course, when solving such puzzles this program would be of limited use - the majority of the effort goes into finding the keyword. It might be interesting to attempt a solver, that given some (possibly partial) pairs of plain and enciphered words would attempt to find possible keywords. Since there are many possibilities even when the encipherments are fully known (since the cipher square can be rotated horizontally and vertically without changing the cipher), the aim would be to minimize the length of the keyword by shifting the longest possible set of ordered letters to the end.
It always surprises me how little information is required to crack a Playfair cipher; just for fun, here's what was provided in a recent crossword once you'd solved all the clues:
with the additional information that the "odd man out" is "the source of the theme".HANDEL => SL??HO LEHRER => OH??KN MOZART => NL??MZ CHOPIN => LK??DR
One minor point: when used for this purpose, the program's habit of grouping letters by fives is a bit irritating; it'd be more convenient in this case for it instead to preserve the whitespace of the original text. Then you could supply "Handel Lehrer Mozart Chopin" as input and get back the ciphertext in the form "xxxxxx xxxxxx xxxxxx xxxxxx". Losing the handling of odd letters and repeats, simplifying to this main loop would achieve that:
Hugowhile (<>) { while (/\G(\W*)(\w)(\W*)(\w)(\W*)/gc) { my($out2, $out4) = transcribe($2, $4); print $1, $out2, $3, $out4, $5; } print $1 if /\G(.*\n?)$/gc; }
In reply to Re: Dubious Cryptography: Playfair Cipher à la Sayers
by hv
in thread Dubious Cryptography: Playfair Cipher à la Sayers
by ChemBoy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |