Encrypt or decrypt text using the Affine substitution cipher, which applies a mathematical transformation to each letter using two keys.
Supported Tools:
Valid values: 1,3,5,7,9,11,15,17,19,21,23,25
Encode or decode text using the Affine substitution cipher.
The Affine cipher is a type of monoalphabetic substitution cipher that encrypts letters using a mathematical formula. Each letter is converted to a number and transformed using the function (a × x + b) mod 26. It is commonly used in cryptography learning to demonstrate modular arithmetic and substitution techniques.
Input:
keydecryptor
Output:
gcyxcspyfzap (example using a=5, b=8)
How does the Affine cipher encrypt text?
Each letter is converted to a number between 0 and 25. The encryption formula (a × x + b) mod 26 is applied to generate a new number, which is then converted back into a letter.
Why must the value of 'a' be coprime with 26?
The value of 'a' must share no common factors with 26 so that a modular inverse exists. Without this inverse, the encrypted text cannot be properly decrypted.
Where is the Affine cipher used today?
The Affine cipher is mainly used in cryptography education, puzzles, and CTF challenges to teach substitution ciphers and modular arithmetic concepts.