raptor-blowfish
v1.4.1
Published
A TypesScript implementation of the Blowfish cipher to encrypt/decrypt messages in ECB and CBC modes.
Readme
Raptor-Blowfish 🐡
A TypeScript implementation of the Blowfish cipher to encrypt/decrypt messages in ECB and CBC modes. Zero runtime dependencies.
Installation
npm install raptor-blowfishyarn add raptor-blowfishUsage
import { Fish } from 'raptor-blowfish';
// ECB
const enc = Fish.createCipher('myLovelyKey');
const encrypted = enc.encrypt('Toxic'); // +OK O3mP5.mY3eCZ
const dec = Fish.createDecipher('myLovelyKey');
const decrypted = dec.decrypt('+OK O3mP5.mY3eCZ'); // Toxic
// CBC
const cbcEnc = Fish.createCipher('cbc:myLovelyKey');
const cbcEncrypted = cbcEnc.encrypt('Toxic'); // +OK * <random IV, different each call>
const cbcDec = Fish.createDecipher('cbc:myLovelyKey');
const cbcDecrypted = cbcDec.decrypt(cbcEncrypted); // Toxic