@irfanshadikrishad/cipher
v1.7.0
Published
A versatile and secure cryptographic library for implementing various cipher algorithms in Node.js applications with zero/0 dependencies.
Maintainers
Readme
@irfanshadikrishad/cipher
A versatile and secure cryptographic library for implementing various cipher algorithms in Node.js applications with zero/0 dependencies.
🚀 Installation
Install the package via npm:
npm install @irfanshadikrishad/cipheryarn:
yarn add @irfanshadikrishad/cipherbun:
bun add @irfanshadikrishad/cipherUsage
Import the library and use a cipher algorithm:
import { Cipher } from '@irfanshadikrishad/cipher'
// Create a Caesar Cipher instance with a shift of 6
const caesar = new Cipher.Caesar(6)
console.log(caesar.encrypt('hello world')) // Output: "nkrru cuxrj"Supported Ciphers
This library provides implementations of various classical and modern ciphers:
| Cipher | Type | Key required? | Strength | Used In/Notes | | ------------------------------------------------------ | ---------------------------------------- | ------------- | --------- | ----------------------------------------------------- | | Caesar Cipher | Substitution | No | Low | Ancient Rome, Simple Obsfuscation | | Atbash Cipher | Substitution | No | Low | Hebrew Cipher, Basic Encryption | | ROT13 | Substitution (Caesar variant) | No | Very Low | Simple text obfuscation, not secure | | Affine Cipher | Substitution | Yes | Low | Generalizes Caesar, teaches modular arithmetic | | Playfair Cipher | Diagraph-based | Yes | Medium | Used in WWI & WWII | | Vigenère Cipher | Polyalphabetic | Yes | Medium | Used in Historical Documents | | The Alphabet Cipher | Polyalphabetic | Yes | Medium | Inspired by Vigenere, Cryptography Puzzles | | Beaufort Cipher | Polyalphabetic (Reciprocal) | Yes | Medium | Vigenere variant where encrypt = decrypt | | Autokey Cipher | Polyalphabetic | Yes | Medium | Plaintext extends the key, fixes Vigenere weakness | | Rail Fence Cipher | Transposition | Yes | Low | Zigzag pattern across N rails | | Columnar Transposition | Transposition | Yes | Medium | Keyword-sorted column reading | | ADFGVX | Polybius Square + Columnar Transposition | Yes | Medium | Used in WWI, Known for 6x6 polybius square | | Nihilist | Polybius Square + Addition | Yes | Medium | Used by Russian Nihilists, Polybius + additive cipher | | Bifid Cipher | Polybius Square + Fractionation | Yes | Medium | Combines coordinates and fractionation | | RC4 | Stream Cipher | Yes | Low | Historically widespread, now considered broken | | Salsa20 | Stream Cipher | Yes | High | Modern Cryptography, Secure Communications | | ChaCha20 | Stream Cipher | Yes | High | Successor to Salsa20, used in TLS 1.3 and WireGuard | | Blowfish | Symmetric Block Cipher | Yes | Medium | Feistel network, variable key length (1–56 bytes) | | DES | Symmetric Block Cipher | Yes | Medium | 56-bit key, Used in legacy systems, replaced by AES | | AES | Symmetric Block Cipher | Yes | High | Also known as Rijndael (CBC mode) | | AES-GCM | Symmetric Block Cipher (AEAD) | Yes | Very High | Authenticated encryption, modern best practice | | ECC | Asymmetric (Public-Key Cryptography) | Yes | Very High | Used in modern systems like Bitcoin, TLS, JWT, etc. | | RSA | Asymmetric (Public-Key Cryptography) | Yes | Very High | Factoring-based, canonical public-key cipher |
Contribution
To contribute on the codebase, follow contribution guideline.
Support
If you find this library useful, consider giving it a ⭐ on GitHub!
Thanks for visiting! (>'-'<)
