Skip to main content

Crate rune_atbash

Crate rune_atbash 

Source
Expand description

Atbash cipher — reverse-alphabet substitution for Latin letters.

Atbash maps each letter to its mirror image in the alphabet: A↔Z, B↔Y, C↔X, and so on. It originated as a Hebrew cipher and is commonly encountered in CTF challenges, historical puzzles, and cryptography courses. This implementation handles Latin (ASCII) letters only, preserving case. Non-letter bytes pass through unchanged.

Because the mapping is its own inverse (mirroring twice is a no-op), encoding and decoding are the same operation. The library has zero dependencies.

§Features

  • atbash — applies Atbash to a string; non-letter characters are unchanged.
  • atbash_bytes — applies Atbash to a raw byte slice.

§Quick Start

use rune_atbash::atbash;

let encoded = atbash("Hello, World!");
assert_eq!(encoded, "Svool, Dliow!");

let decoded = atbash(&encoded);
assert_eq!(decoded, "Hello, World!");

§CLI

rune-atbash "Hello, World!"
echo "Hello, World!" | rune-atbash
rune-atbash -f message.txt

Functions§

atbash
Applies the Atbash cipher to a UTF-8 string, substituting only ASCII letters.
atbash_bytes
Applies the Atbash cipher to a raw byte slice, substituting only ASCII letters.