All Projects → robertklep → node-metrohash

robertklep / node-metrohash

Licence: MIT license
Node.js bindings for MetroHash

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language
javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to node-metrohash

Swift Crypto
Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
Stars: ✭ 1,005 (+3920%)
Mutual labels:  hash-functions
Data.hashfunction
C# library to create a common interface to non-cryptographic hash functions.
Stars: ✭ 226 (+804%)
Mutual labels:  hash-functions
nthash
ntHash implementation in Rust
Stars: ✭ 26 (+4%)
Mutual labels:  hash-functions
Scala Hashing
Fast non-cryptographic hash functions for Scala
Stars: ✭ 66 (+164%)
Mutual labels:  hash-functions
Hash Identifier
Software to identify the different types of hashes used to encrypt data and especially passwords
Stars: ✭ 198 (+692%)
Mutual labels:  hash-functions
node-express-reddit-clone
Build a Node, Express and MySQL-based clone of Reddit for DecodeMTL web development bootcamp
Stars: ✭ 28 (+12%)
Mutual labels:  hash-functions
Streebog
GOST R 34.11-2012: RFC-6986 cryptographic hash function
Stars: ✭ 24 (-4%)
Mutual labels:  hash-functions
SHA.jl
A performant, 100% native-julia SHA1, SHA2, and SHA3 implementation
Stars: ✭ 35 (+40%)
Mutual labels:  hash-functions
Python Hashes
Interesting (non-cryptographic) hashes implemented in pure Python.
Stars: ✭ 213 (+752%)
Mutual labels:  hash-functions
xxHash-Swift
xxHash framework in Swift.
Stars: ✭ 22 (-12%)
Mutual labels:  hash-functions
Meow hash
Official version of the Meow hash, an extremely fast level 3 hash
Stars: ✭ 1,204 (+4716%)
Mutual labels:  hash-functions
Mum Hash
Hashing functions and PRNGs based on them
Stars: ✭ 117 (+368%)
Mutual labels:  hash-functions
crypto-primitives
Interfaces and implementations of cryptographic primitives, along with R1CS constraints for them
Stars: ✭ 76 (+204%)
Mutual labels:  hash-functions
Nabhash
An extremely fast Non-crypto-safe AES Based Hash algorithm for Big Data
Stars: ✭ 62 (+148%)
Mutual labels:  hash-functions
prvhash
PRVHASH - Pseudo-Random-Value Hash. Hash functions, PRNG with unlimited period, randomness extractor. (Codename Gradilac/Градилак)
Stars: ✭ 194 (+676%)
Mutual labels:  hash-functions
Java Crypto Utils
Java Cryptographic, Encoding and Hash Utilities
Stars: ✭ 15 (-40%)
Mutual labels:  hash-functions
LibSWIFFT
LibSWIFFT - A fast C/C++ library for the SWIFFT secure homomorphic hash function
Stars: ✭ 23 (-8%)
Mutual labels:  hash-functions
prune-horst
Signature scheme submitted to NIST's Post-Quantum Cryptography Project
Stars: ✭ 23 (-8%)
Mutual labels:  hash-functions
XXHash
XXHash - Extremely fast hash algorithm,impl for csharp,can process 11.8 GB/s on modern cpu. impl with net core 2.0 and .net
Stars: ✭ 24 (-4%)
Mutual labels:  hash-functions
triehash
Generator for order-preserving minimal perfect hash functions in C
Stars: ✭ 36 (+44%)
Mutual labels:  hash-functions

node-metrohash

Wrapper around MetroHash.

Build Status Build status

Installation

$ npm install metrohash

API change!

Between v1 and v2, the API for this library has changed to allow for maximum hashing speed.

The biggest change is that a calculated hash is now returned as a (hex-encoded) string instead of a Buffer.

If a Buffer is still required, it's easy to convert the string:

let buffer = Buffer.from(metrohash64('input'), 'hex');

Also, the .hash() methods for the hasher classes have been removed in favor of standalone functions (see below).

Usage

The module exports 2 classes, MetroHash64 and MetroHash128, and two functions, metrohash64 and metrohash128.

The classes are meant for incremental hashing, the functions for standalone hash calculations.

The class constructors and functions accept an optional seed numerical argument, which defaults to 0.

Class interface

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

// Constructor.
MetroHash64(seed? : number) : this

// Update.
MetroHash64#update(input : String | Buffer) : this

// Finalize and get hash digest.
MetroHash64#digest() : String

(likewise for MetroHash128).

Function interface

const metrohash64 = require('metrohash').metrohash64;

metrohash64(input : String | Buffer, seed? : number) : String

(likewise for metrohash128).

Examples

//// Classes

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

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

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

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

// Finalize to get the digest as a hex string.
let digest = hash.digest();

//// Functions
const metrohash64 = require('metrohash').metrohash64;

let digest = metrohash64('Hello, World!', 123);

Speed

From v2.0 onwards, MetroHash is pretty fast.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].