1.0.12 • Published 2 years ago

es6-sladex-blowfish v1.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ES6 Sladex Blowfish

npm package

Blowfish encryption library for browsers and Node.js from Dojo Toolkit 1.8.1 | Cut of by Sladex (xslade@gmail.com)

Works in Node.js 4+, IE10+ and all modern browsers.

Table of Contents

Installation

npm install es6-sladex-blowfish --save

Usage

All input data should be a String. Strings support all unicode including emoji ✨.

Example

import Blowfish, { MODE, TYPE } from 'es6-sladex-blowfish';

// third parameter is optional
const encrypted = Blowfish.encrypt("input text even with emoji 🎅", "super key",{cipherMode: MODE.ECB, outputType: TYPE.BASE64});

// third parameter is optional
const decrypted = Blowfish.decrypt(encrypted, "super key", {cipherMode: MODE.ECB, outputType: TYPE.BASE64}) as string)

console.log(encrypted);
console.log(decrypted);

Block cipher mode of operation

https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation

MODE.ECB; // (default) Electronic Codebook
MODE.CBC; // Cipher Block Chaining
MODE.PCBC; // Propagating Cipher Block Chaining
MODE.CFB; // Cipher Feedback
MODE.OFB; // Output Feedback
MODE.CTR; // Counter

Return type

Which type of data should return method decode:

TYPE.BASE64; // (default) Base64 String;
TYPE.HEX; // HexaDecimal String;
TYPE.STRING; // Uint8Array String;
TYPE.RAW; // Uint8Array
1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago