Socket
Socket
Sign inDemoInstall

mumba-hash

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mumba-hash

Hashing with Promises.


Version published
Maintainers
1
Install size
236 kB
Created

Readme

Source

Mumba Hash

Hashing with Promise support.

Installation

$ npm install --save mumba-hash

Examples

Normal usage:

import {Hash} from "mumba-hash";

let hash = new Hash();

// Create a hash on "foo" with the default 5 iterations.
hash.create('foo')
	.then(function (hash) {
		// This will give us a "$2a$05..." type of hash.
		console.log(hash);
	})
	.catch(console.error);

PHP compatible mode:

let hash = new Hash({ php: true });

// Create a hash on "foo" with the default 5 iterations.
hash.create('foo')
	.then(function (hash) {
		// This will give us a "$2y$05..." type of hash.
		console.log(hash);
	})
	.catch(console.error);

Comparing hashes with submitted text (such as a passphrase):

let storedHash = '$2a$05$tpkxsCGs3DQAulwg8jMLm.2m6onpogPyISQUltka1LLUBgQ9EO1xG';

hash.compare('foo', storedHash)
	.then(function (result) {
		console.log(result ? "It's a match" : "This is not a match";
	});

Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of Mumba Hash is Andrew Eddie.

List of all contributors

License

Apache 2.0


© 2016 Mumba Pty Ltd. All rights reserved.

Keywords

FAQs

Last updated on 01 Aug 2016

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc