Affine cipher
From Wikipedia, the free encyclopedia
The Affine cipher is a special case of the more general substitution cipher. It is monoalphabetic and symmetric.
In affine ciphers the encryption function for a letter is e(x) = (ax + b)(mod m) where,
- a and m are coprime (otherwise a would have no multiplicative inverse modulo m).
- m is the size of the alphabet.
The decryption function is d(x) = a − 1(x − b)(mod m) where a − 1 is the multiplicative inverse of a in the group 
This cipher is less secure than a substitution cipher as it is vulnerable to all of the attacks that work against substitution ciphers as well as other attacks. 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 a and m are relatively prime this can be used to rapidly discard many "false" keys in an automated system.
|
Classical cryptography
|
|---|
| Ciphers: ADFGVX | Affine | Alberti | Atbash | Autokey | Bifid | Book | Caesar | Four-square | Hill | Keyword | Nihilist | Permutation | Pigpen | Playfair | Polyalphabetic | Polybius | Rail Fence | Reihenschieber | Reservehandverfahren | ROT13 | Running key | Scytale | Smithy code | Solitaire | Straddling checkerboard | Substitution | Tap Code | Transposition | Trifid | Two-square | VIC cipher | Vigenère |
| Cryptanalysis: Frequency analysis | Index of coincidence |
| Misc: Cryptogram | Bacon | Polybius square | Scytale | Straddling checkerboard | Tabula recta |
| History of cryptography | Cryptanalysis | Cryptography portal | Topics in cryptography |
| Symmetric-key algorithm | Block cipher | Stream cipher | Public-key cryptography | Cryptographic hash function | Message authentication code | Random numbers |