Involutary cipher (like ROT13) for an alphabet with an odd number of symbols
ROT13 has the nice property of being an involution for an A-Z alphabet (26 letters), th开发者_如何学Cat is to say:
ROT13(ROT13(string-A-to-Z)) = string-A-to-Z ;
What is a simple cipher function for an alphabet with an odd number of symbols that has the same property? Obviously, a straight-up substitution won't work, but I'm looking for something nearly as simple.
Either exclude one of the symbols in the alphabet from the cipher, or supplement it with a symbol not in the alphabet.
Such a cipher is necessarily the product of disjoint transpositions, so if you had an odd number of letters, one would have to remain in place.
You could "reverse" the alphabet, switching A
with Z
and B
with Y
etc.
精彩评论