Skip to content

finnp/node-dollar-hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dollar-hash

Build Status License MIT Version

A module for creating hashes, which indicate the algorithm being used like "alg$hash". Install it with npm install dollar-hash.

It was inspired and can be used for the specification of the Open Badges verification. Actually it is adapted from a piece of code written by @brianloveswords in this wiki

var hash = require('dollar-hash')

var text = 'the text to hash'
var dollarhash = hash(text, 'mysalt', 'sha256')

hash.verify(dollarhash, text, 'mysalt', 'sha256')
// evaluates to true

Methods

hash(text[, salt, algorithm])

Creates a dollar hash of text, optionally with a specific salt and algorithm (defaults to sha256).

hash.verify(dollarhashed, text[, salt, algorithm])

Compares the hash of text with dollarhashed, optionally using a salt and a specific algorithm (defaults to sha256). Returns a boolean value.

hash.create / hash.hash

Aliases of hash.

About

A module for creating hashes which indicate the algorithm like `alg$hash`

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published