ForHosting KIT · Developer Utilities

Gronsfeld cipher

With the key 31415, ATTACKATDAWN encrypts to DUXBHNBXEFZO: each digit shifts the next letter forward by that many places, and the key repeats until the message ends. Decrypting shifts back the same way. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
ATTACKATDAWN
Key
31415
Calculation mode
Encrypt
You get
Result
DUXBHNBXEFZO
Input
ATTACKATDAWN
Text
DUXBHNBXEFZO
Letters shifted
12

The Gronsfeld cipher is a classical polyalphabetic system that looks like Vigenère but uses a string of digits instead of a letter keyword: each digit from zero to nine is the Caesar shift applied to the next letter of your message, and the digit stream repeats until every letter is processed.

How the numeric key and letter shifts work

Gronsfeld is easiest to understand as Vigenère with a restricted key alphabet of ten symbols. Write your secret as a sequence of decimal digits; the first digit is the shift for the first letter, the second digit for the second letter, and so on, wrapping back to the start of the key when the message is longer than the key.

Encryption adds the digit to the letter index in the Latin alphabet and reduces modulo twenty-six; decryption subtracts the same digit with the same modular wrap so a round trip restores the original letters. Case is preserved: an uppercase A shifted by three becomes D, and a lowercase a becomes d, which keeps sample phrases readable in demos. Characters that are not letters—spaces, commas, digits inside the message body, emoji—pass through unchanged and do not consume a key position, matching the usual polyalphabetic teaching convention.

A key that contains any non-digit character after trimming whitespace is invalid: Gronsfeld is defined by a numeric key, so letters, spaces, and punctuation in the key field are errors rather than a silent fallback to a Vigenère keyword.

Practical tips, limits, and related searches

Choose a key with several distinct digits so the shift stream is not a single Caesar cipher in disguise; short memorable sequences still work for demos, but longer irregular digit strings shuffle the alphabet more. Remember that only letters advance the key: if you encrypt a phrase with spaces, the spaces remain and the next letter still takes the next digit, which is what students expect when they mark columns by hand.

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 polyalphabetic cryptography with a pure digit key for education or puzzles; if you need real secrecy, use a modern authenticated cipher instead.

CTF and puzzle verification

Challenge authors check Gronsfeld encrypt and decrypt for a published numeric key without maintaining a separate offline script.

Historical crypto demos

Museums and blog demos show how a digit key differs from a letter Vigenère keyword by live-encrypting visitor phrases in the browser.

What is the Gronsfeld cipher?

A classical polyalphabetic cipher: like Vigenère, but the key is a string of digits 0–9. Each digit is the Caesar shift for the corresponding letter, repeating as needed.

How is Gronsfeld different from Vigenère?

Gronsfeld restricts the key to digits 0–9, so each shift is at most nine places.

What happens if the key has letters or spaces?

A Gronsfeld key must contain only digits 0–9 after trimming.

Do spaces and punctuation get encrypted?

No. Only A–Z and a–z are shifted. Other characters pass through and do not consume a key digit.

Is the Gronsfeld cipher free?

The browser tool is free and runs locally.

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.

POSThttps://api.kit.forhosting.com/enc/gronsfeld

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.

curl -X POST https://api.kit.forhosting.com/enc/gronsfeld \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"ATTACKATDAWN","key":"31415"}'
{
  "text": "ATTACKATDAWN",
  "key": "31415"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "enc.gronsfeld",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_chars100000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Enter the text you want to protect or recover, a numeric key such as three one four one five, and a mode of encrypt or decrypt; the tool shifts letters modulo twenty-six while preserving case, leaves spaces and punctuation untouched, and rejects any key that is not pure digits with a clear invalid_input error so a typo never silently becomes a wrong alphabet.

How the numeric key and letter shifts work

Empty text and empty keys are likewise rejected so the API never returns an identity transform that looks successful but teaches nothing.

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 string fields, text and key, 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 digits, numeric_key, secret, k, and passphrase; mode accepts operation, op, direction, and action, and recognizes common synonyms such as encode or decode. The key must be non-empty after trim and must match only characters zero through nine; any letter, space, or punctuation yields invalid_input and is never charged. On success the response echoes the original input text, reports key as the normalized digit string, mode as encrypt or decrypt, result and text as the transformed string, letters_shifted and non_letters as counts, key_length as the number of digits, length as the output character count, shifts_applied as the ordered list of digits used for each letter in order, 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

Keep payloads under the published maximum of one hundred thousand characters so Worker memory stays bounded. When teaching, pair examples: ATTACKATDAWN with key three one four one five shows a classic polyalphabetic encrypt; the same ciphertext with mode decrypt recovers the phrase; and a key containing a letter demonstrates the hard invalid_input path required by the product contract. This landing targets people searching for a Gronsfeld cipher, numeric-key Vigenère, or digit-shift encryptor online; it is not AES, not a modern password vault, not Playfair digraphs, and not ROT13. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients probe non-digit keys.

Classroom polyalphabetic labs

Students apply digit shifts by hand, then compare letter-by-letter results and the shifts_applied list against the deterministic API output.

Read the full KIT documentation →