- Affine cipher
The Affine cipher is a special case of the more general monoalphabetic
substitution cipher . In affine ciphers the encryption function for a letter is where,* and are
coprime (otherwise would have nomultiplicative inverse modulo ).
* is the size of the alphabet.The decryption function is where is the multiplicative inverse of in the group
Considering the specific case of encrypting messages in English (i.e. ), there are a total of 286 non-trivial affine ciphers, not counting the trivial Caesar ciphers obtained when . This lack of variety renders the system as highly insecure when considered in light of Kerckhoffs' Principle. Even without foreknowledge that a text were enciphered with an affine cipher, the ciphertext would have all of the vulnerabilities of ordinary monoalphabetic
substitution cipher s.The cipher's primary weakness comes from the fact that if the cryptanalyst can discover (by means of frequency analysis, brute force, guessing or otherwise) the plaintext of two ciphertext characters then the key can be obtained by solving a
simultaneous equation . Since we know and are relatively prime this can be used to rapidly discard many "false" keys in an automated system.The same type of transformation used in affine ciphers is used in
linear congruential generator s, a type ofpseudorandom number generator . This generator is not acryptographically secure pseudorandom number generator for the same reason that the affine cipher is not secure.See also
*
Topics in cryptography
*Affine function s
Wikimedia Foundation. 2010.