Skip to content

applefreak/golombcodedsets.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

golombcodedsets.js

This is an NPM package with a refactored version of https://github.com/rasky/gcs

const gcs = require('golombcodedsets');

const builder = new gcs.GCSBuilder(20, 10);

console.log('Adding "item1" & "item2"')
builder.add('item1')
builder.add('item2')

const hash = builder.toBase64()

console.log('base64 representation of the set:', hash)

const query = new gcs.GCSQuery(hash)

console.log('Checking "item2":', query.query('item2'))
console.log('Checking "item3":', query.query('item3'))

Custom hash functions

The default are the 32 least significant bits of a md5 hash; Using murmurhash (default now) instead:

const murmurhash = require('murmurhash');

const builder = new gcs.GCSBuilder(numberOfItems, error_probability, murmurhash.v3);
const query = new gcs.GCSQuery(arrayBuffer, murmurhash.v3);

Parameter of the hash function should be a string, while the output is an integer.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%