Atbash
Simple monoalphabetic substitution cipher originally used on the Hebrew alphabetA simple linear cipher originally used on the Hebrew alphabet.
How it works
Encoding
The Atbash cipher is pretty simple, and all its does is reverse the letters in the alphabet: A becomes Z, B becomes Y, ..., Y becomes B, Z becomes A.
Here's the full table:
A | B | C | D | E | F | G | H | I | J | K | L | M |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Z | Y | X | W | V | U | T | S | R | Q | P | O | N |
Encoding the word crypto
, we get:
C R Y P T O
X I B K G L
Decoding
We can observe that applying the code twice to a message letter, will leave us with the original message. To decrypt, we just have to re-apply the code.
X I B K G L
C R Y P T O
Cons
- Pretty simple and famous cipher.
- Frequency analysis can be used to crack the code, if the message is long enough.
Implementations
Language | Encrypt | Decrypt |
---|---|---|
C | AtbashCipher.c | AtbashCipher.c |
C++ | main.cpp | main.cpp |
Javascript | encrypt.js | decrypt.js |
Python | encrypt.py | decrypt.py |
Swift | lib.swift | lib.swift |
Source: CrypTools Cipher Repository