Ciphers

Caesar

Shift every letter by N. Default 3, keyspace 25, and the attack is all of them.
IDcaesar01 / 72classical · substitution-shift
Cipher / Shift

Caesar Cipher

Shift every letter by N.

Keyspace
25
Decode
same options back
Works on
A-Z, the rest passes
Family
3 in shift
required 0 / 1

Options

shiftnumber
default 3
Number of positions to shift (1-25)

Access

Createcreate("caesar")
CLIciphers encode caesar 'ATTACK AT DAWN' --shift 3
Tryplayground with the sample above
Kinrot13, rot47

Every letter moves shift places down the alphabet and wraps from Z back to A. Default is 3, the one Suetonius says Caesar used. A shift is an integer from 1 to 25. Zero is the identity and 26 is zero again, both rejected.

ts
import { create } from "@agntn/ciphers";

const caesar = create("caesar");
caesar.encode("ATTACK AT DAWN").text; // "DWWDFN DW GDZQ"
caesar.encode("Hello, World!", { shift: 7 }).text; // "Olssv, Dvysk!"
caesar.decode("DWWDFN DW GDZQ", { shift: 3 }).text; // "ATTACK AT DAWN"

Case survives, punctuation and spaces stay put. Decode with the wrong shift and you get another Caesar, which is why brute force exists: ciphers brute "KHOOR ZRUOG" prints all 25, and shift 3 reads HELLO WORLD.

ROT-13 is this with the shift nailed to 13.