simhash

0.1.0 • Public • Published

simhash

A node module to calculate the simhash (http://matpalm.com/resemblance/simhash/)

Installation

npm install simhash

Example

Simhash is hash that returns similar hash(es) for similar input - in contrast to other hashing algorithms.

// will use crc32 as crypto algorithm as standard
var simhash = require('simhash')();
 
var result1 = simhash(['a', 'list', 'of', 'a', 'couple', 'of', 'tokens']);
// return1 is [0,0,0,1,0,0,1,1,1,0,1,1,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0]
 
var result2 = simhash(['a', 'list', 'of', 'a', 'couple', 'of', 'tokens', '!']);
// result2 is [0,0,0,1,0,0,0,1,1,0,0,1,0,1,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,1,0]

You can also choose to use another algoritm than the standard crc32 one

var simhash = require('simhash')('md5');
 
var result = simhash(['a', 'list', 'of', 'a', 'couple', 'of', 'tokens']);

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    55
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    55
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i simhash

Weekly Downloads

55

Version

0.1.0

License

MIT

Last publish

Collaborators

  • kesla