Ciphers

A1Z26

A is 1 and Z is 26. Every letter as its place in the alphabet. Plus the single digit form where letters stand for digits.
IDa1z2617 / 55classical · fractionation
Cipher / Fractionation

A1Z26

A is 1, Z is 26, dashes between.

Keyspace
1, or 17 in the single digit form
Decode
same options back
Works on
A-Z, or 0-9 with zero, the rest passes
Family
8 in fractionation
required 0 / 2

Options

separatorstring
default -
Text between the numbers of one word, up to 10 characters without digits
zerostring
optional
Letter from J to Z that stands for 0. Setting it switches to the single digit form, where encode turns digits into letters

Access

Createcreate("a1z26")
CLIciphers encode a1z26 'ATTACK AT DAWN'
Tryplayground with the sample above
Kinpolybius, morse, bacon, tap-code +3

A is 1, B is 2, Z is 26. That's the whole cipher. Puzzles use it all the time, and counting to 19 on your fingers for every S is where the typos come from.

ts
const a1z26 = create("a1z26");
a1z26.encode("DCODE").text; // "4-3-15-4-5"
a1z26.decode("8-5-12-12-15, 23-15-18-12-4!").text; // "HELLO, WORLD!"
a1z26.decode("1.12.16.8.1.2.5.20", { separator: "." }).text; // "ALPHABET"

Separators

separator goes between the numbers of one word. It's - by default, and up to 10 characters. Anything that isn't a letter stays where it was, so spaces keep the words apart and commas stay commas.

Decoding drops the separator only between two numbers. Everything else survives. With separator: " " a single space joins letters, so 1 2 3 4 5 reads ABC DE. The double space is still a word gap. Not sure what the puzzle used? Ask guess. It names the separator it saw most.

Digits in the plaintext are a trap, though. AGENT 007 encodes to 1-7-5-14-20 007, and the way back reads 007 as G. A1Z26 has no room for digits. That's on the cipher, not on you.

The single digit form

Some puzzles turn it around. Letters stand for digits: A to I are 1 to 9, and some other letter is 0. So bef is 256. Read it as plain A1Z26 and you get garbage, which is exactly what those pages count on.

Set zero to the letter that means 0 and you're in that form. It has to be J to Z, since A to I are taken.

ts
a1z26.decode("bef", { zero: "o" }).text; // "256"
a1z26.encode("20 1990", { zero: "o" }).text; // "BO AIIO"

Decoding turns A to I and the zero letter into digits, in either case. Every other character passes. Which letter is 0 is up to the puzzle. O looks like it, J comes right after I. Try both.

Checked against

The dCode A1Z26 page: DCODE is 4-3-15-4-5, and 1.12.16.8.1.2.5.20 is ALPHABET. For the single digit form, bef as 256.

Errors

A number outside 1 to 26 is a CipherError naming the number and where it sits: Invalid A1Z26 number 27 at character 3. A leading zero is fine, 01 is A. A zero that isn't one letter from J to Z is an InvalidOptionError. So is a separator that's empty, longer than 10 characters or has a digit in it. And a separator next to zero, which doesn't use one.