Graph
Affine Cipher

➗Affine Cipher

NEW

A monoalphabetic substitution cipher that maps letters via an affine function in modular arithmetic.

DESCRIPTION

The affine cipher encrypts each letter by mapping it to a numeric value and applying E(x)=ax+b mod m, then converting back to a letter. It generalizes Caesar (a=1) and relies on a and m being coprime for invertibility. Like other monoalphabetic ciphers, it is vulnerable to frequency analysis and provides no modern security. It is primarily used for education and illustrating modular arithmetic in cryptography.

ALTERNATIVE DEFINITIONS

Wikipedia

In classical cryptography, the affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using a simple mathematical function, and converted back to a letter.

Emphasizes numeric mapping and affine transformation in modular arithmetic.

Source

Wolfram MathWorld

The affine cipher replaces each letter x by ax + b (mod m), where a and m are coprime, and then maps back to a letter.

Formal definition highlighting invertibility conditions and function form.

Source

Substitution Monoalphabetic Substitution Caesar Cipher Atbash Cipher Frequency Analysis Modular Arithmetic Plaintext Ciphertext Classical Cryptography

COMPETING TERMS

Vigenère Cipher

RELATIONS

KNOWLEDGE AREAS

Data Security Mathematics

TARGET AUDIENCE

Cybersecurity Engineer Security Architect Software Developer Data Scientist

EXTERNAL SOURCES

TOP QUESTIONS

How does the Affine Cipher work?

Letters are mapped to numbers, transformed by E(x)=ax+b mod m, then mapped back, using an invertible a with respect to m.

Category: Example

Is the Affine Cipher secure?

No. Like other monoalphabetic ciphers, it’s easily broken by frequency analysis and known-plaintext attacks.

Category: Risks

How does the Affine Cipher relate to the Caesar Cipher?

Caesar is a special case with a=1; the affine cipher generalizes shifts with both a multiplier and offset.

Category: Misunderstanding

What’s a common mistake with the Affine Cipher?

Choosing a non-coprime a yields a non-invertible mapping, making decryption impossible or ambiguous.

Category: Mistakes

How is the Affine Cipher broken?

Frequency analysis and solving simple linear equations mod m recover a and b from ciphertext samples.

Category: Testing

Where is the Affine Cipher used today?

In education and demonstrations of modular arithmetic and classical cryptography concepts.

Category: Relevancy

What is the role of modular arithmetic in the Affine Cipher?

It ensures wrap-around within the alphabet and defines invertibility conditions for decryption.

Category: Example

What are appropriate alphabets for the Affine Cipher?

Any finite alphabet; typically 26 letters, but it can extend to custom symbol sets with modulus m.

Category: Opinion

How to practice implementing the Affine Cipher?

Start with a simple alphabet, write encrypt/decrypt functions, and test on sample texts and known keys.

Category: Getting Started