cipherwave
v1.0.0
Published
Varying Caesar cipher encryption with secret-based shifting and salting
Downloads
7
Maintainers
Readme
Cipherwave
Cipherwave is a lightweight, secret-based encryption library that extends the Caesar Cipher concept. It uses a varying shift pattern derived from a secret key, shuffles the character set, adds salting, and applies multiple encryption passes for stronger obfuscation.
Cipherwave is ideal for lightweight encryption needs like token generation, secure ID masking, license keys, and obscured messaging where full cryptographic encryption (AES, RSA) would be too heavy.
Features
- Varying Caesar Cipher: Each character is shifted based on the corresponding character in the secret.
- Shuffled Character Set: The character list is shuffled deterministically based on the secret, making patterns harder to detect.
- Salting: A random salt is prepended to the message before encryption, ensuring different outputs even for the same input.
- Multiple Encryption Passes: The encryption is applied twice to enhance complexity.
- Secret Enforcement: Requires a minimum 16-character secret for security.
- Simple API: Initialize once, then easily encode and decode messages.
Installation
Install Cipherwave using npm:
npm install cipherwaveBasic Usage
Importing
import { initialize, encode, decode } from "cipherwave";Initialization
Before using encode or decode, initialize the library with your secret and optional salt length:
initialize({
secret: process.env.CIPHERWAVE_SECRET!,
saltLength: 8 // Optional, defaults to 8
});Important: The secret must be at least 16 characters long. Shorter secrets will cause an error.
Encoding
const encrypted = encode("This is a secret message!");
console.log(encrypted); // Encrypted stringDecoding
const decrypted = decode(encrypted);
console.log(decrypted); // "This is a secret message!"API Reference
initialize(options: { secret: string; saltLength?: number }): void
Initialize Cipherwave with encryption settings.
secret(string) - The secret key used for varying shifts and shuffling (minimum 16 characters).saltLength(`number) - Optional. The length of the random salt to prepend (default is 8).
encode(message: string): string
Encrypt a message using the initialized secret and salt settings.
message(string) - The plaintext message to encrypt.- Returns: Encrypted string.
decode(encodedMessage: string): string
Decrypt a previously encoded message.
encodedMessage(string) - The encrypted message to decrypt.- Returns: Original plaintext message.
How It Works
Character Set Shuffling A full set of allowed characters (letters, numbers, symbols) is shuffled based on the secret using a deterministic pseudo-random process. Every secret produces a unique shuffle.
Varying Shifts Each character of the input message is shifted by an amount based on the corresponding character of the secret (looping over the secret if necessary). This results in a dynamic, non-linear shift pattern.
Salting A random string (salt) of specified length is prepended to the input before encoding. This makes encryptions of the same message produce different results.
Multiple Encryption Passes Cipherwave applies the encryption process twice to increase the complexity and further obscure any patterns.
Full Example
import { initialize, encode, decode } from "cipherwave";
// Step 1: Initialize
initialize({
secret: "ThisIsASecretKey1234",
saltLength: 12
});
// Step 2: Encrypt
const plaintext = "Sensitive Data!";
const encrypted = encode(plaintext);
console.log("Encrypted:", encrypted);
// Step 3: Decrypt
const decrypted = decode(encrypted);
console.log("Decrypted:", decrypted); // Output: "Sensitive Data!"Security Considerations
Cipherwave provides lightweight encryption and strong obfuscation against casual inspection and basic attacks. However, it is not intended for highly sensitive information (e.g., passwords, credit cards, legal documents).
For high-security encryption, use modern cryptographic algorithms such as AES-256 or RSA-4096.
Cipherwave is ideal for:
- ID obfuscation
- License key generation
- URL-safe token generation
- Lightweight message protection
Final Notes
Cipherwave brings modern improvements to the classical Caesar cipher concept through secret-driven variable shifts, character set randomization, salting, and multiple passes. It offers strong obfuscation capabilities with a lightweight footprint.
Enjoy encrypting with Cipherwave! 🔥
