Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metrohash

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metrohash

Node.js bindings for MetroHash hashing library

  • 1.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
122
decreased by-52.71%
Maintainers
1
Weekly downloads
 
Created
Source

node-metrohash

Wrapper around MetroHash.

Build Status

Installation

$ npm install metrohash

Usage

The module exports 2 classes, MetroHash64 and MetroHash128.

Both have the same interface:

// Constructor.
Hash([ seed:Number = 0 ]) : Object

// Update.
Hash#update(input : [String | Buffer]) : void

// Finalize and get hash digest.
Hash#digest() : Buffer

// One-shot: hash input and return digest.
Hash#hash(input : [String | Buffer]) : Buffer

Examples

var MetroHash64 = require('metrohash').MetroHash64;

// Instantiate using seed 123 (`new` is optional).
var hash = new MetroHash64(123);

// Update using a string as input.
hash.update('Hello, World!');

// The same as above:
// hash.update('Hello, ').update('World!');

// Finalize and convert to hex string.
var digest = hash.digest().toString('hex');

// Or as one-shot:
var digest = MetroHash64(123).hash('Hello, World!').toString('hex');

FAQs

Package last updated on 10 Sep 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc