es6-sladex-blowfish
TypeScript icon, indicating that this package has built-in type declarations

1.0.12 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.12
    40
    • latest

Version History

Package Sidebar

Install

npm i es6-sladex-blowfish

Weekly Downloads

47

Version

1.0.12

License

ISC

Unpacked Size

20.5 kB

Total Files

4

Last publish

Collaborators

  • mikaelboff