Multiplicative cipher
With key 5, HELLO becomes JUDDS: each letter is multiplied by your key modulo 26, and decrypting uses its inverse, 21. Keys that share a factor with 26 are refused, so the message can always be recovered. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- HELLO
- Integer multiplicative key
- 5
- Calculation mode
- Encrypt
- Result
- JUDDS
- Input
- HELLO
- Key mod
- 5
- Key inverse
- 21
The multiplicative cipher is a classical monoalphabetic system that multiplies each letter index by a secret integer key modulo twenty-six: plaintext A maps to zero, B to one, and so on through Z to twenty-five, then C equals k times P mod twenty-six on encrypt and the modular inverse of k restores the original on decrypt.
How the coprime key and modular multiply work
Multiplicative cipher is easiest to understand as a Caesar cipher where addition is replaced by multiplication in the ring of integers modulo twenty-six. Write each Latin letter as an integer from zero for A through twenty-five for Z. Encryption multiplies that index by your secret key k and reduces modulo twenty-six; decryption multiplies by the modular inverse of k, the unique residue k inverse such that k times k inverse is congruent to one modulo twenty-six.
That inverse exists if and only if the greatest common divisor of the absolute value of k and twenty-six is one—equivalently, k is odd and not a multiple of thirteen. Valid positive residues are one, three, five, seven, nine, eleven, fifteen, seventeen, nineteen, twenty-one, twenty-three, and twenty-five; any even key or any multiple of thirteen shares a factor with twenty-six and is rejected. Case is preserved: an uppercase H multiplied by five becomes J, and a lowercase h becomes j, which keeps sample phrases readable in demos.
Characters that are not letters—spaces, commas, digits inside the message body, emoji—pass through unchanged.
What you can do with it
CTF and puzzle verification
Challenge authors check multiplicative encrypt and decrypt for a published coprime key without maintaining a separate offline script.
Historical crypto demos
Museums and blog demos show why only keys coprime with twenty-six yield reversible maps by live-encrypting visitor phrases in the browser.
FAQ
What is the multiplicative cipher?
Decrypt multiplies by the modular inverse of k.
Why must the key be coprime with 26?
Only when gcd(|key|, 26) = 1 is multiplication by k bijective mod 26, so every ciphertext letter maps back to exactly one plaintext letter. Shared factors collapse the alphabet.
Which keys are valid?
Any integer whose absolute value is coprime with 26. Positive residues mod 26: 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25. Even keys and multiples of 13 are rejected.
Do spaces and punctuation get encrypted?
No. Only A–Z and a–z are multiplied mod 26. Other characters pass through unchanged.
Is the multiplicative cipher free?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/enc/multiplicative \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"HELLO","key":5}'const res = await fetch("https://api.kit.forhosting.com/enc/multiplicative", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "HELLO",
"key": 5
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/multiplicative",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "HELLO",
"key": 5
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/multiplicative", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"HELLO","key":5}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"HELLO","key":5}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/multiplicative", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"text": "HELLO",
"key": 5
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.multiplicative",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_chars | 100000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Enter the text you want to protect or recover, an integer key such as five or seventeen, and a mode of encrypt or decrypt; the tool multiplies letters while preserving case, leaves spaces and punctuation untouched, and rejects any key that shares a factor with twenty-six—even numbers and multiples of thirteen—with a clear invalid_input error so a non-bijective map never silently collapses the alphabet.
How the coprime key and modular multiply work
Empty text and missing keys are likewise rejected so the API never returns an identity transform that looks successful but teaches nothing about modular arithmetic.
How to call the API and what comes back
Text must be a non-empty string of at most one hundred thousand characters. Send a JSON body with two required fields, text as a non-empty string and key as an integer, plus an optional mode that defaults to encrypt when omitted. Accepted aliases for text include input, value, data, message, plaintext, and ciphertext; key also accepts k, multiplier, a, secret, and factor; mode accepts operation, op, direction, and action, and recognizes common synonyms such as encode or decode. The key may be sent as a JSON number or as a pure integer string; fractional numbers and non-numeric strings yield invalid_input and are never charged. On success the response echoes the original input text, reports key as the integer you sent, key_mod as that key reduced into zero through twenty-five, key_inverse as the modular inverse used for decryption, mode as encrypt or decrypt, result and text as the transformed string, letters_processed and non_letters as counts, length as the output character count, formula as a short modular mnemonic, and message as a one-line English summary. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
Round-trip checks are the best sanity test: encrypt a phrase, decrypt the result with the same key, and confirm the letter stream matches the original case-sensitive input. Prefer this capability when you need transparent classical monoalphabetic cryptography with a pure multiplicative key for education or puzzles; if you need real secrecy, use a modern authenticated cipher instead. Keep payloads under the published maximum of one hundred thousand characters so Worker memory stays bounded. When teaching, pair examples: HELLO with key five encrypts to JUDDS; the same ciphertext with mode decrypt and key five recovers HELLO; and key two or key thirteen demonstrates the hard invalid_input path required when the key shares a factor with twenty-six. This landing targets people searching for a multiplicative cipher, modular inverse encryptor, or coprime-key letter cipher online; it is not AES, not RSA, not the full affine cipher with an additive offset, and not ROT13. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients probe even keys or multiples of thirteen.
Integration use cases
Classroom modular-arithmetic labs
Students multiply letter indices by hand, compute modular inverses, and compare letter-by-letter results against the deterministic API output and key_inverse field.