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 - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

package.json
{
"name": "metrohash",
"version": "1.1.0",
"version": "1.2.0",
"description": "Node.js bindings for MetroHash hashing library",

@@ -5,0 +5,0 @@ "scripts" : {

@@ -35,3 +35,3 @@ # node-metrohash

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

@@ -38,0 +38,0 @@

@@ -17,8 +17,40 @@ var MetroHash64 = require('./index').MetroHash64;

describe('MetroHash', function() {
describe('Instantiation and method calling', function() {
it('new MetroHash64() should work', function() {
expect(function() { new MetroHash64(); }).to.not.throw();
});
it('MetroHash64() should work', function() {
expect(function() { MetroHash64(); }).to.not.throw();
});
it('new MetroHash128() should work', function() {
expect(function() { new MetroHash128(); }).to.not.throw();
});
it('MetroHash128() should work', function() {
expect(function() { MetroHash128(); }).to.not.throw();
});
it('MetroHash64() should allow chaining', function() {
expect(function() {
new MetroHash64().update(TESTVECTOR_B).digest().toString('hex');
}).to.not.throw();
});
it('MetroHash128() should allow chaining', function() {
expect(function() {
new MetroHash128().update(TESTVECTOR_B).digest().toString('hex');
}).to.not.throw();
});
});
describe('Test vectors', function() {
TESTS.forEach(function(test) {
var suffix = test.seed !== undefined ? ', ' + test.seed + ')' : ')';
it(test.cls.name + '(String' + suffix, function() {
it('new ' + test.cls.name + '(String' + suffix, function() {
var instance = new test.cls(test.seed);

@@ -29,3 +61,9 @@ instance.update(TESTVECTOR_S);

it(test.cls.name + '(Buffer' + suffix, function() {
it(test.cls.name + '(String' + suffix, function() {
var instance = test.cls(test.seed);
instance.update(TESTVECTOR_S);
expect(instance.digest().toString('hex').toUpperCase()).to.equal(test.expected);
});
it('new ' + test.cls.name + '(Buffer' + suffix, function() {
var instance = new test.cls(test.seed);

@@ -36,10 +74,10 @@ instance.update(TESTVECTOR_B);

});
it(test.cls.name + '(Buffer' + suffix, function() {
var instance = test.cls(test.seed);
instance.update(TESTVECTOR_B);
expect(instance.digest().toString('hex').toUpperCase()).to.equal(test.expected);
});
it('should allow chaining', function() {
expect(function() {
new MetroHash64().update(TESTVECTOR_B).digest().toString('hex');
}).to.not.throw();
});
});
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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