This project is a simple implementation of a custom text cipher built in vanilla JavaScript. It’s loosely inspired by the classic Atbash cipher, but with a personalized twist.
- Encrypts lowercase letters using reversed halves of the alphabet:
a–m→ reversed asm–an–z→ reversed asz–n
- Leaves non-alphabet characters (spaces, punctuation, numbers) unchanged
- Minimal logic, beginner-friendly, no external libraries
- Console-based interaction using
prompt()andconsole.log()
- You enter a message via a prompt.
- Each character is checked:
- If it's in the first half of the alphabet (
a–m), it's replaced by its mirror in that half. - If it's in the second half (
n–z), it's replaced by its mirror in that half. - Any other character (space, punctuation, etc.) is preserved.
- If it's in the first half of the alphabet (
- The result is printed to the console.
Input: Hello, World! Output: svool, dliow!
- Clone the repo or copy the code from
script.js - Open the file in your browser or use a live JavaScript environment
- You’ll be prompted to enter a message
- The encrypted message will be logged in the console
- Add decryption (this cipher is symmetric)
- Support uppercase letters
- Build a UI for web-based encryption
- Host as a playground on Vercel or Netlify
- Turn it into a mini NPM package
Pull requests and suggestions are welcome!
If you have ideas for improving or extending this cipher, feel free to open an issue or submit a PR.
This project is licensed under the MIT License.
Henry Odunsi
Frontend Developer | Builder | Problem Solver
LinkedIn • Portfolio