Socket
Book a DemoInstallSign in
Socket

salteen

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

salteen

A snappy and lightweight (259B) utility to encrypt and decrypt values with salt.

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
472
204.52%
Maintainers
1
Weekly downloads
 
Created
Source

salteen Build Status

A snappy and lightweight (259B) utility to encrypt and decrypt values with salt.

Both encrypt and decrypt are factory functions that accept a salt key and return new functions to be called with the unique value(s) to handle. This allows you reuse instances across multiple values.

This module is available in three formats:

  • CommonJS: dist/salteen.js
  • ESModule: dist/salteen.mjs
  • UMD: dist/salteen.min.js

Install

$ npm install --save salteen

Usage

const { encrypt, decrypt } = require('salteen');

const MY_SALT = 'foobar'; // PS: the longer the better

const encoder = encrypt(MY_SALT);
const decoder = decrypt(MY_SALT);

['hello', 'world'].map(encoder);
//=> ['7f727b7b78', '6078657b73']

['7f727b7b78', '6078657b73'].map(decoder);
//=> ['hello', 'world']

API

encrypt(salt)

Returns: Function

Returns a new Function which will accept a value<String> to be encrypted, using salt as the salting value.

salt

Type: String

The salting value to be used – longer salts are more secure.

decrypt(salt)

return Function

Returns a new Function which will accept a value<String> to be decrypted, using salt as the salting value.

salt

Type: String

The salting value to be used – longer salts are more secure.

Benchmarks

Results below are with Node v11.11.0

encrypt  x 281,299 ops/sec ±0.66% (97 runs sampled)
decrypt  x 383,827 ops/sec ±1.81% (90 runs sampled)

License

MIT © Luke Edwards

Keywords

encrypt

FAQs

Package last updated on 24 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts