Skip to content
Test versionSearch

Developer tools

Affine ASCII transform and modular inverse

Affine ASCII transform and modular inverse. Apply the declared arithmetic transformation and inspect its exact text result.

How it worksFAQRelated tools

Content reviewed:

The example values can be changed. Press Calculate to update the result; you can download it as TXT or CSV and collect scenarios in this tab. Nothing is saved or sent automatically.

ASCII y=(a·x+b) mod 26. Only invertible a; reverse with modular inverse. Preserve case and other characters. Educational/puzzle transformations, no protection for confidential data. Input 400 UTF16 units (Caesar all mode 200), result 500 characters each; no controls or unpaired surrogates. No Unicode transliteration. Press Calculate to update the result; you can download it as TXT or CSV. JSON and HTML downloads include your inputs and the numbers as calculated. Live calculation is off unless you switch it on. Nothing is saved or sent automatically.

Decimal results are approximate. Inputs stay in this browser tab.

How it works

Own declared arithmetic text shifts, substitutions and code-point permutations; educational only. Own structured JSON/result-row TXT/printable HTML files retain original inputs, options and result values. ASCII y=(a·x+b) mod 26. Only invertible a; reverse with modular inverse. Preserve case and other characters. Educational/puzzle transformations, no protection for confidential data. Input 400 UTF16 units (Caesar all mode 200), result 500 characters each; no controls or unpaired surrogates. No Unicode transliteration. Press Calculate to update the result; you can download it as TXT or CSV. JSON and HTML downloads include your inputs and the numbers as calculated. Live calculation is off unless you switch it on. Nothing is saved or sent automatically.

Worked example

With these example values the calculator gives the result below. You can change any value in the form above.

Inputs

Direction
Encode
Multiplier a:1–25, coprime to 26
5
Offset b:−1000–1000
8
Text or encoded input
Affine Cipher äß🚀

Result

Result text
Ihhwvc Swfrcp äß🚀
Result code points
17

Frequently asked questions

How does the affine cipher transform text?

The affine ASCII transform applies y = (a·x + b) mod 26 to each ASCII letter. Letter case and all other characters are preserved.

Which values of a can I use in the affine cipher?

Only invertible values: a must be from 1 to 25 and coprime to 26, otherwise the transformation could not be reversed.

How do I decode an affine cipher?

Decoding reverses the transformation with the modular inverse of a, using the same a and b that were used for encoding.

What does the affine cipher example produce?

Encoding with a = 5 and b = 8 turns Affine Cipher into Ihhwvc Swfrcp. Non-ASCII characters such as ä and ß stay unchanged, because there is no Unicode transliteration.

Is the affine cipher safe for confidential data?

No. The affine ASCII transform is an educational and puzzle transformation and offers no protection for confidential data.

What are the input limits of the affine ASCII transform?

Input is limited to 400 UTF-16 units and each result to 500 characters. Control characters and unpaired surrogates are not accepted.