Search code examples
language-agnosticfunctionmathencryptionrot13

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), that 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.


Solution

  • Either exclude one of the symbols in the alphabet from the cipher, or supplement it with a symbol not in the alphabet.