---
title: "Alberti"
description: "A keyed inner disk against a fixed outer alphabet, turned one step after every period letters. Simplified on purpose, so it's reproducible."
canonical_url: "https://ciphers.agntn.dev/ciphers/alberti"
---
# Alberti

> A keyed inner disk against a fixed outer alphabet, turned one step after every period letters. Simplified on purpose, so it's reproducible.

<cipher-facts name="alberti">



</cipher-facts>

Alberti's disk of 1467 had a fixed outer ring and a movable inner ring, and the operator turned the inner ring by agreement. That agreement is the problem - two implementations, two answers. So this one fixes it: the inner disk is the keyword with duplicate letters removed, then the rest of the alphabet, and it rotates one position after every `period` Latin letters. `key` and `period` are both required, `period` a positive integer.

```ts
const alberti = create("alberti");
alberti.encode("ATTACK AT DAWN", { key: "ALBERTI", period: 4 }).text; // "ASSAEH LU TBYN"
alberti.decode("ASSAEH LU TBYN", { key: "ALBERTI", period: 4 }).text; // "ATTACK AT DAWN"
alberti.encode("AAAA A", { key: "KEY", period: 4 }).text; // "KKKK E", the disk turned after four
```

Only ASCII letters count toward the period and the rotation, anything else passes through. This isn't a historical simulation. It's a disk with a clock, which is what a puzzle setter usually means when they write "Alberti".


## Sitemap

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