Hawkynt

Autokey Cipher

Enhanced Vigenère cipher that extends the key using plaintext itself, eliminating periodic key repetition. Uses initial keyword plus plaintext letters to create non-repeating key sequence. More secure than standard Vigenère. Input domain: every byte is accepted. A-Z and a-z are enciphered in place with their case preserved and are the only bytes that extend the running key, which uses their uppercase form; every other byte - digit, punctuation, whitespace, control or high-bit - is carried through unchanged and takes no part in the key, which is the usual pen-and-paper convention and makes the round trip exact for arbitrary input. Nothing is ever discarded.

Properties

Property Value
Category Classical Ciphers
Sub-category Classical Cipher
Security status 🎓 Educational Only
Complexity Intermediate
Inventor Blaise de Vigenère
Year 1586
Origin 🇫🇷 France
Source algorithms/classical/autokey.js

Security

Status: 🎓 Educational Only

Known vulnerabilities

Issue Description Mitigation
Probable Plaintext Attack If portion of plaintext is known, can recover key and decrypt remainder of message Avoid predictable beginnings or known phrases
Statistical Analysis While more secure than Vigenère, still vulnerable to advanced statistical attacks Educational use only

Documentation

References

Test vectors

3 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.

Vector 1 — Classic Autokey Example

Field Value
key 4c454d4f4e
input 41545441434b41544441574e
expected 4c58464f504b544d4443474e

Vector 2 — Educational Test Vector

Field Value
key 4b4559
input 48454c4c4f
expected 52494a5353

Vector 3 — DCode Reference

Field Value
key 4155544f4b4559
input 44434f4445
expected 445748524f

← All algorithms