SecurityFree Tool

Affine Cipher

Provided byInventive HQinventivehq.com

Encrypt and decrypt with affine cipher (ax + b mod 26). Includes brute force mode and modular inverse calculator

Screenshot of Affine Cipher on Inventive HQ
inventivehq.comOpen the live tool →
About this tool

What Affine Cipher does

The Affine Cipher tool on Inventive HQ applies the classic monoalphabetic substitution formula (ax + b mod 26) to transform plain text into ciphertext or recover the original message. Users input integer keys 'a' and 'b' along with their text, and the utility outputs the encrypted or decrypted result while automatically calculating the modular inverse required for decryption. The service is designed to handle the mathematical steps of the cipher, making it accessible for those learning or practicing basic cryptography.

Step by step

How to use the Inventive HQ Affine Cipher

  1. 1

    Enter an integer key 'a' that is coprime with 26

  2. 2

    Enter an integer key 'b' for the additive component

  3. 3

    Input the plain text or cipher text to transform

  4. 4

    Click Encrypt or Decrypt to see the result and the calculated modular inverse

Is it right for you

Best for

Security students and cryptography enthusiasts learning the mechanics of monoalphabetic substitution ciphers.

Limitations

  • Requires the key 'a' to be coprime with 26 for valid decryption
  • Operates on the standard 26-letter Latin alphabet only
  • No support for non-alphabetic characters or multi-language text
Questions

Affine Cipher FAQ

What happens if key 'a' is not coprime with 26?
The tool will not be able to calculate a valid modular inverse, making decryption impossible; 'a' must share no common factors with 26 other than 1.
Can the tool handle numbers or symbols in the input text?
The utility processes only alphabetic characters; numbers and symbols are typically ignored or removed during the encryption and decryption process.
How does the brute force mode work?
Brute force mode tests multiple valid key combinations automatically, helping users recover the original message when the correct keys are unknown.
Is the output case-sensitive?
The cipher typically normalizes input to uppercase, and the output is returned in uppercase letters without preserving the original casing.