Digrafid cipher
Run Delastelle's Digrafid cipher with two keywords: DCODE with the keys KEYWORD and SECRET and a period of 3 becomes LTYDK#, and the same keys and period bring the letters back, padding included. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Text
- DCODE
- Key1
- KEYWORD
- Key2
- SECRET
- Calculation mode
- Encrypt
- Period
- 3
- Result
- LTYDK#
- Length
- 6
- Letters mapped
- 5
- Padded
- 1
The Digrafid cipher is a classical digraph fractionating system invented by Félix Delastelle. It combines two independently keyed alphabets of twenty-seven symbols—the Latin letters A through Z plus a null hash—on complementary three-by-nine and nine-by-three grids, linked by a fixed three-by-three numeric bridge. Plaintext is split into letter pairs; each pair becomes a three-digit coordinate triplet, those triplets are stacked for a chosen period and re-read by columns like Trifid, and the new triplets map back to ciphertext digraphs. You supply the message, both keywords, an optional period, and encrypt or decrypt mode.
How Digrafid digraph fractionation works with two keyed alphabets
Digrafid begins by building two twenty-seven-symbol alphabets from your keywords. Unique Latin letters and optional hash characters from key1 fill the horizontal three-by-nine grid first, then the remaining symbols of A–Z and hash complete the grid in natural order; key2 does the same for the vertical nine-by-three grid. A third numeric three-by-three bridge always holds the digits one through nine in row-major order and never depends on the keys.
Encryption splits the letter stream into digraphs of two symbols each. For a digraph with first letter L1 and second letter L2, the engine records the column of L1 on the horizontal grid, the bridge digit at the intersection of L1’s row and L2’s column, and the row of L2 on the vertical grid, forming a three-digit triplet. Period many digraphs write their triplets as successive rows of three digits; the block is then read column by column into a stream that is re-grouped into new three-digit triplets.
Each new triplet is inverted: the middle digit locates a row and column on the bridge, the first digit with that bridge row selects a letter on the horizontal grid, and the third digit with that bridge column selects a letter on the vertical grid, producing one ciphertext digraph. Blocks continue until the whole message is consumed. When the letter count is not a multiple of twice the period, the engine pads with hash symbols so every block is complete.
Decrypting uses the same involution with the same keys and period, so applying the transform again recovers the original letter stream including any padding.
Where Digrafid cipher tools show up in real work
Introductory cryptography and history-of-ciphers courses assign Digrafid drills so students practice digraph coordinates and then see how fractionation across a period block changes the ciphertext compared with a plain two-square or Playfair digraph map; a single trusted oracle that encrypts and decrypts with two keyed alphabets speeds homework demos and auto-graders. Capture-the-flag challenges and American Cryptogram Association style puzzles still hide Digrafid messages behind two short keywords and a period, and solvers want a fast, predictable Delastelle implementation rather than a general cryptanalysis suite.
Support and content teams sometimes lightly encode spoilers, quiz answers, or internal labels with a shared pair of keywords and need the reverse path without installing a language-specific crypto library. If you need Bifid single-square fractionation, Trifid three-coordinate cubes, four-square digraph substitution without fractionation, Playfair keyword squares, or automatic frequency-analysis recovery of unknown keys, treat those as separate search intents and landings rather than overloading this classical Digrafid page.
What you can do with it
Classroom Digrafid and digraph fractionation demos
Encrypt and decrypt sample digraphs with two shared keywords so intro-crypto lessons show 3×9 / 9×3 grids and period fractionation on one ground-truth oracle.
Puzzle and CTF Digrafid challenges
Encode or reverse Delastelle Digrafid ciphertexts for challenge strings without writing a one-off script for every problem set and period.
FAQ
What is the Digrafid cipher?
A classical digraph fractionating cipher by Félix Delastelle that uses two keyed alphabets (3×9 and 9×3 over A–Z plus '#') and a 3×3 numeric bridge. Digraphs become coordinate triplets that are fractionated by period and mapped back to letter pairs.
Why are two keys required?
Key1 builds the horizontal 3×9 alphabet and key2 builds the vertical 9×3 alphabet.
How do I decrypt a Digrafid ciphertext?
Set mode to decrypt, paste the ciphertext symbols, and use the same key1, key2, and period that encrypted them. The transform is an involution: the same process recovers the original letter stream (including any padding '#').
How is Digrafid different from Bifid or four-square?
Bifid fractionates single letters on one 5×5 Polybius square. Four-square substitutes digraphs on four 5×5 squares without coordinate fractionation. Digrafid fractionates digraph coordinates across two 27-symbol alphabets with a numeric bridge and a period block.
What does it cost?
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/digrafid \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"DCODE","key1":"KEYWORD","key2":"SECRET"}'const res = await fetch("https://api.kit.forhosting.com/enc/digrafid", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"text": "DCODE",
"key1": "KEYWORD",
"key2": "SECRET"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/enc/digrafid",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"text": "DCODE",
"key1": "KEYWORD",
"key2": "SECRET"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/enc/digrafid", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"text":"DCODE","key1":"KEYWORD","key2":"SECRET"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"text":"DCODE","key1":"KEYWORD","key2":"SECRET"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/enc/digrafid", 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": "DCODE",
"key1": "KEYWORD",
"key2": "SECRET"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "enc.digrafid",
"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.
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
Empty keys, letter-free keys, or text with no A–Z or hash symbols fail with invalid_input and a clear English message.
How Digrafid digraph fractionation works with two keyed alphabets
There is no random pad, no timestamp, and no network call—identical inputs always yield identical JSON. This landing implements classical period-bounded Digrafid on two keyed twenty-seven-symbol alphabets only, not Bifid, not Trifid, not four-square, and not automatic cryptanalysis of unknown keys.
What you send and what you get back
Send a required string field named text, required string fields key1 and key2 for the horizontal and vertical alphabets, an optional mode set to encrypt or decrypt, and an optional integer period from two to ten for digraphs per fractionation block. When mode is omitted, encrypt is the default; when period is omitted, three digraphs per block is the classical default, matching six-letter blocks used in many textbook examples. Classic checks include encrypting DCODE with plain alphabets and period three to the stable ciphertext MOLGAZ, decrypting that ciphertext with the same keys back to the padded form, and confirming that empty key1 or key2 is rejected rather than inventing a default alphabet. Each key must contain at least one Latin letter A–Z or a hash after normalization; an empty string, whitespace-only key, or key made only of digits and punctuation fails with invalid_input and a message that names which key was empty. On success the response echoes mode, text, key1, key2, and period, returns result as the uppercase transformed digraph string including any padding hashes, length of that result, letters_mapped as how many input symbols participated before padding, padded as how many hash pads were added, alphabet1 and alphabet2 as the twenty-seven-character fills used for the run, and cipher set to digrafid for clients that assert the profile they hit. Missing text, missing keys, non-string objects for those fields, unsupported mode values, period outside the allowed range, strings longer than the documented maximum, and payloads with no letters or hashes all fail with invalid_input and a clear English message. Validation failures do not consume prepaid balance. Pricing for successful API calls is the published base of $0.002 per item.
Where Digrafid cipher tools show up in real work
Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.
Integration use cases
Lightweight dual-key label encoding
Turn quiz answers or internal labels into Digrafid digraph streams and decode them later with the same keys and period in browser or API.