开发者

Involutary cipher (like ROT13) for an alphabet with an odd number of symbols

开发者 https://www.devze.com 2023-01-28 05:29 出处:网络
ROT13 has the nice property of being an involution for an A-Z alphabet (26 letters), th开发者_如何学Cat is to say:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消