---
title: "Getting Started"
description: "Install, encode one line, decode it back. Same shape from every cipher."
canonical_url: "https://ciphers.agntn.dev/guide"
---
# Getting Started

> Install, encode one line, decode it back. Same shape from every cipher.

<warning title="Pre-1.0">

The API and the tool list can still move. Pin exact versions if you build on it now.

</warning>

<caution title="Not audited">

This code has never had a security audit. Do not use it in production, with real funds or with sensitive data. It is meant for agents, puzzles and local experiments only. It comes as is, without warranty of any kind, and the authors are not liable for any loss, as the MIT license states. Anything that matters wants an audited library.

</caution>

<caution title="Nothing here protects a secret">

Lessons, riddles, CTFs, yes. Secrets, no. Anyone with a laptop breaks the classical ciphers in seconds. Half the block ciphers run in ECB, which shows every block that repeats, and none of the code was made constant time.

</caution>

## Why this exists

A puzzle says "the key is LEMON" and I want the plaintext, not a lecture. An agent gets a ROT-47 string in a challenge and needs to flip it without leaving the process. Each cipher is small, but every one of them has conventions that decide whether your answer matches the author's: does Playfair fold J into I, does Bacon use 24 or 26 letters, which rotors is "Enigma" even. Every online tool picks something different and rarely says what.

So `@agntn/ciphers` picks once, writes it down, and gives every cipher the same two methods. No HTTP, no keys, no telemetry. It runs in your process and that's it.

## Install

```bash
pnpm add @agntn/ciphers
```

## First call

```ts [vigenere.ts]
import { create } from "@agntn/ciphers";

const vigenere = create("vigenere");

const encoded = vigenere.encode("ATTACK AT DAWN", { key: "LEMON" });
console.log(encoded.text); // LXFOPV EF RNHR

const decoded = vigenere.decode(encoded.text, { key: "LEMON" });
console.log(decoded.text); // ATTACK AT DAWN
```

The package ships seventy-five ciphers from one list. `create(name)` gives you one cached instance and wants the exact registry name. `resolveCipher("Rail Fence")` lowercases, turns spaces into hyphens, and then also wants an exact match. No prefixes, no fuzzy matching, a typo is an `UnknownCipherError`. Guessing which cipher you meant is how you get the wrong plaintext with a straight face.

## The shape

Every `encode` and `decode` returns this:

```ts
interface CipherResult {
  text: string; // the output
  cipher: string; // "vigenere"
  operation: "encode" | "decode";
  options: Record<string, unknown>; // what was actually applied, defaults included
  normalizedInput?: string; // optional, for a cipher that reshapes its input; the built-ins leave it out
}
```

Every `classical` cipher understands two options. `preserveCase` (default `true`) keeps lowercase letters lowercase. `stripNonAlpha` (default `false`) drops everything that isn't a letter before the cipher runs.

The rest is per cipher: `shift`, `key`, `secondKey`, `transposition`, `square`, `rotation`, `omit`, `orientation`, `indicator`, `indicatorUnder`, `blanks`, `symbol`, `alphabet`, `separator`, `zero`, `book`, `address`, `pick`, `start`, `rails`, `width`, `corner`, `path`, `a`, `b`, `period`, `letters`, `lowercase`, `positions`, `rings`, `plugboard`, `iv`, `segment`, `blockSize`, `nonce`, `aad`, `counter`, `tagLength`, `tweak`, `endian`, `bytes`, `digest`, `algorithm`, `count`, `keys`, `entry`, `method`, `keyLength`, `iterations`, `salt`.

Each cipher's page lists its own, and so does `create(name).info()`.

## What ships

<table>
<thead>
  <tr>
    <th>
      Cipher
    </th>
    
    <th>
      Family
    </th>
    
    <th>
      Options
    </th>
    
    <th align="center">
      Self-inverse
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/caesar">
        caesar
      </a>
    </td>
    
    <td>
      shift
    </td>
    
    <td>
      <code>
        shift
      </code>
      
       (1 to 25, default 3)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rot13">
        rot13
      </a>
    </td>
    
    <td>
      shift
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rot47">
        rot47
      </a>
    </td>
    
    <td>
      shift
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/atbash">
        atbash
      </a>
    </td>
    
    <td>
      reflection
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/substitution">
        substitution
      </a>
    </td>
    
    <td>
      mixed alphabet
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/vigenere">
        vigenere
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/gronsfeld">
        gronsfeld
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (digits 0 to 9)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/beaufort">
        beaufort
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/porta">
        porta
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        rotation
      </code>
      
       (left or right, default left)
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/autokey">
        autokey
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/running-key">
        running-key
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (a letter per letter of the text)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/trithemius">
        trithemius
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/alberti">
        alberti
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        period
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/quagmire-1">
        quagmire-1
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        indicator
      </code>
      
      , <code>
        indicatorUnder
      </code>
      
       (default A)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/quagmire-2">
        quagmire-2
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        indicator
      </code>
      
      , <code>
        indicatorUnder
      </code>
      
       (default A)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/quagmire-3">
        quagmire-3
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        indicator
      </code>
      
      , <code>
        indicatorUnder
      </code>
      
       (default A)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/quagmire-4">
        quagmire-4
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        secondKey
      </code>
      
      , <code>
        indicator
      </code>
      
      , <code>
        indicatorUnder
      </code>
      
       (default A)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/chaocipher">
        chaocipher
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (left alphabet), <code>
        secondKey
      </code>
      
       (right alphabet)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/affine">
        affine
      </a>
    </td>
    
    <td>
      multiplicative
    </td>
    
    <td>
      <code>
        a
      </code>
      
       (default 5), <code>
        b
      </code>
      
       (default 8)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/playfair">
        playfair
      </a>
    </td>
    
    <td>
      digraph
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/four-square">
        four-square
      </a>
    </td>
    
    <td>
      digraph
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        secondKey
      </code>
      
      , <code>
        omit
      </code>
      
       (j or q, default j)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/two-square">
        two-square
      </a>
    </td>
    
    <td>
      digraph
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        secondKey
      </code>
      
      , <code>
        orientation
      </code>
      
       (vertical or horizontal, default vertical), <code>
        omit
      </code>
      
       (j or q, default j)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/hill">
        hill
      </a>
    </td>
    
    <td>
      polygraphic
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        alphabet
      </code>
      
       (default A-Z)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/polybius">
        polybius
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       optional, <code>
        alphabet
      </code>
      
       (default A-Z, J as I)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/nihilist">
        nihilist
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        square
      </code>
      
       optional
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/morse">
        morse
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/fractionated-morse">
        fractionated-morse
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/bacon">
        bacon
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        letters
      </code>
      
       (24 or 26, default 26), <code>
        lowercase
      </code>
      
       (A or B, decoding only)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/tap-code">
        tap-code
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/a1z26">
        a1z26
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        separator
      </code>
      
       (default <code>
        -
      </code>
      
      ), <code>
        zero
      </code>
      
       optional
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/book">
        book
      </a>
    </td>
    
    <td>
      homophonic
    </td>
    
    <td>
      <code>
        book
      </code>
      
       (required), <code>
        address
      </code>
      
       (default <code>
        word
      </code>
      
      ), <code>
        pick
      </code>
      
       (default <code>
        word
      </code>
      
      ), <code>
        start
      </code>
      
       (default 1)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/adfgvx">
        adfgvx
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       optional, <code>
        transposition
      </code>
      
       optional
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/bifid">
        bifid
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       optional, <code>
        period
      </code>
      
       (default 5), <code>
        alphabet
      </code>
      
       (default A-Z, J as I)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/trifid">
        trifid
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       optional, <code>
        period
      </code>
      
       (default 5), <code>
        symbol
      </code>
      
       (default <code>
        +
      </code>
      
      )
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/straddling-checkerboard">
        straddling-checkerboard
      </a>
    </td>
    
    <td>
      fractionation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       optional (28 cells), <code>
        blanks
      </code>
      
       (default <code>
        26
      </code>
      
      )
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/tridigital">
        tridigital
      </a>
    </td>
    
    <td>
      mixed alphabet
    </td>
    
    <td>
      <code>
        key
      </code>
      
      , <code>
        secondKey
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rail-fence">
        rail-fence
      </a>
    </td>
    
    <td>
      transposition
    </td>
    
    <td>
      <code>
        rails
      </code>
      
       (default 3)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/columnar">
        columnar
      </a>
    </td>
    
    <td>
      transposition
    </td>
    
    <td>
      <code>
        key
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/route">
        route
      </a>
    </td>
    
    <td>
      transposition
    </td>
    
    <td>
      <code>
        width
      </code>
      
      , <code>
        corner
      </code>
      
       (default <code>
        top-left
      </code>
      
      ), <code>
        path
      </code>
      
       (default <code>
        spiral-clockwise
      </code>
      
      )
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/enigma">
        enigma
      </a>
    </td>
    
    <td>
      rotor
    </td>
    
    <td>
      <code>
        positions
      </code>
      
      , <code>
        rings
      </code>
      
      , <code>
        plugboard
      </code>
    </td>
    
    <td align="center">
      ✓
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes">
        aes
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-cbc">
        aes-cbc
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        iv
      </code>
      
       (32 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-cfb">
        aes-cfb
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        iv
      </code>
      
       (32 hex digits), <code>
        segment
      </code>
      
       (default 128)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-ofb">
        aes-ofb
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        iv
      </code>
      
       (32 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-ctr">
        aes-ctr
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        iv
      </code>
      
       (32 hex digits, the first counter block)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-ccm">
        aes-ccm
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        nonce
      </code>
      
       (14 to 26 hex digits), <code>
        aad
      </code>
      
      , <code>
        tagLength
      </code>
      
       (default 128)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-ocb">
        aes-ocb
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits), <code>
        nonce
      </code>
      
       (2 to 30 hex digits), <code>
        aad
      </code>
      
      , <code>
        tagLength
      </code>
      
       (default 128)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-lrw">
        aes-lrw
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64, 80 or 96 hex digits), <code>
        tweak
      </code>
      
       (default 1)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-xts">
        aes-xts
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64 or 128 hex digits), <code>
        tweak
      </code>
      
       (default 0)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-cbc-mac">
        aes-cbc-mac
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aes-passphrase">
        aes-passphrase
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (the passphrase, any text), <code>
        digest
      </code>
      
       (default md5), <code>
        keyLength
      </code>
      
       (default 256), <code>
        iterations
      </code>
      
       (default 1), <code>
        salt
      </code>
      
       (default random)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rijndael">
        rijndael
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 40, 48, 56 or 64 hex digits), <code>
        blockSize
      </code>
      
       (default 128)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/des">
        des
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (16 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/desx">
        desx
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (48 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/triple-des">
        triple-des
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 or 48 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/triple-des-cbc">
        triple-des-cbc
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 or 48 hex digits), <code>
        iv
      </code>
      
       (16 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/blowfish">
        blowfish
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (8 to 112 hex digits, an even number)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/idea">
        idea
      </a>
    </td>
    
    <td>
      lai-massey
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/lucifer">
        lucifer
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/mars">
        mars
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 to 112 hex digits, in steps of 8)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/serpent">
        serpent
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/cast5">
        cast5
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (10 to 32 hex digits, whole bytes)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/camellia">
        camellia
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/aria">
        aria
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32, 48 or 64 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/sm4">
        sm4
      </a>
    </td>
    
    <td>
      feistel
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 hex digits)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/openpgp">
        openpgp
      </a>
    </td>
    
    <td>
      substitution-permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (the passphrase, any text), <code>
        algorithm
      </code>
      
       (default aes256), <code>
        digest
      </code>
      
       (default sha512), <code>
        count
      </code>
      
       (default 65011712), <code>
        salt
      </code>
      
       and <code>
        iv
      </code>
      
       (default random)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rabbit">
        rabbit
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 hex digits), <code>
        iv
      </code>
      
       (16 hex digits, optional), <code>
        endian
      </code>
      
       (default <code>
        big
      </code>
      
      )
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/rc4">
        rc4
      </a>
    </td>
    
    <td>
      permutation
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (2 to 512 hex digits, whole bytes)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/xor">
        xor
      </a>
    </td>
    
    <td>
      polyalphabetic
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (any whole bytes in hex), <code>
        bytes
      </code>
      
       (default <code>
        text
      </code>
      
      )
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/salsa20">
        salsa20
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (32 or 64 hex digits), <code>
        nonce
      </code>
      
       (16 hex digits), <code>
        counter
      </code>
      
       (default 0)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/xsalsa20">
        xsalsa20
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64 hex digits), <code>
        nonce
      </code>
      
       (48 hex digits), <code>
        counter
      </code>
      
       (default 0)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/chacha20">
        chacha20
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64 hex digits), <code>
        nonce
      </code>
      
       (24 hex digits), <code>
        counter
      </code>
      
       (default 0)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/xchacha20">
        xchacha20
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64 hex digits), <code>
        nonce
      </code>
      
       (48 hex digits), <code>
        counter
      </code>
      
       (default 0)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/chacha20-poly1305">
        chacha20-poly1305
      </a>
    </td>
    
    <td>
      arx
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (64 hex digits), <code>
        nonce
      </code>
      
       (24 hex digits), <code>
        aad
      </code>
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
  
  <tr>
    <td>
      <a href="https://ciphers.agntn.dev/ciphers/zipcrypto">
        zipcrypto
      </a>
    </td>
    
    <td>
      crc-lcg
    </td>
    
    <td>
      <code>
        key
      </code>
      
       (the password, any text) or <code>
        keys
      </code>
      
       (24 hex digits), <code>
        entry
      </code>
      
       (default the first encrypted one), <code>
        method
      </code>
      
       (default deflate), <code>
        iv
      </code>
      
       (default random)
    </td>
    
    <td align="center">
      ✗
    </td>
  </tr>
</tbody>
</table>

## Errors

```ts
import { CipherError, InvalidOptionError, MissingOptionError, UnknownCipherError } from "@agntn/ciphers";

try {
  create("caesar").encode("HELLO", { shift: 26 });
} catch (error) {
  if (error instanceof InvalidOptionError) {
    error.option; // "shift"
    error.reason; // why 26 is not a shift
  }
}
```

No key where a key is required, `MissingOptionError`. A name nobody registered, `UnknownCipherError`, and its message lists the names that are, so `rot-13` comes back with `rot13` in the same line. A value out of range, `InvalidOptionError` with the option, the value and the reason. Anything else a cipher throws gets wrapped by `normalizeError` into a `CipherError` that names the cipher. The CLI prints the message and exits 1. No stack trace. You did nothing wrong, the input did.

## Next

- [Encode and decode](https://ciphers.agntn.dev/guide/transform): options, case, what happens to punctuation, the round trip.
- [Analysis](https://ciphers.agntn.dev/guide/analysis): brute force a Caesar, read a histogram.
- [CLI](https://ciphers.agntn.dev/guide/cli): the `ciphers` command.
- [Agents](https://ciphers.agntn.dev/guide/agents): the tools over MCP, Pi, OMP and the AI SDK.
- [Custom ciphers](https://ciphers.agntn.dev/guide/custom): extend `Cipher`, register it.
- [Playground](https://ciphers.agntn.dev/playground): every cipher, in the page.


## Sitemap

See the full [sitemap](https://ciphers.agntn.dev/sitemap.md) for all pages.
