ceasar-js
v0.1.1
Published
A simple Caesar cipher encryption/decryption library
Maintainers
Readme
🔐 Ceasar
A simple JavaScript library for Caesar cipher encryption and decryption.
Easily shift letters of your message with a Caesar cipher — useful for simple encoding, fun puzzles, or learning about classical encryption techniques.
📦 Installation
Install via npm:
npm install ceasar🚀 Quick Usage
Node.js (CommonJS)
const { cypher, decypher } = require('ceasar');
const original = "Hello, World!";
const shift = 3;
const encrypted = cypher(original, shift); // "Khoor, Zruog!"
const decrypted = decypher(encrypted, shift); // "Hello, World!"
console.log("Encrypted:", encrypted);
console.log("Decrypted:", decrypted);ES Modules (ESM)
import { cypher, decypher } from 'ceasar';
console.log(cypher("abc", 1)); // bcd
console.log(decypher("bcd", 1)); // abc🧠 API
cypher(text: string, shift: number): string
Encodes a string using Caesar cipher logic by shifting characters forward.
text: The input stringshift: The number of characters to shift by (positive integer)
decypher(text: string, shift: number): string
Decodes a Caesar cipher encoded string by shifting characters backward.
text: The encrypted stringshift: The original shift value used during encryption
✨ Examples
cypher("xyz", 3); // "abc"
decypher("abc", 3); // "xyz"
cypher("Secret!", 4); // "Wigvix!"
decypher("Wigvix!", 4) // "Secret!"🔧 CLI (Coming Soon)
Want to encrypt from the terminal? Stay tuned for CLI support!
📄 License
MIT License © 2025 Mickyas Tesfaye
🙌 Contribute
Feel free to open issues or PRs to improve or extend the library.
