Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

merkle-tools

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

merkle-tools - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

1

merkletools.js

@@ -80,3 +80,2 @@ /*jslint node: true */

if (leafCount > 0) { // skip this whole process if there are no leaves added to the tree
var levelCount = Math.ceil(Math.log2(leafCount)) + 1;
tree.levels.unshift(tree.leaves);

@@ -83,0 +82,0 @@ while (tree.levels[0].length > 1) {

2

package.json
{
"name": "merkle-tools",
"version": "1.0.4",
"version": "1.0.5",
"description": "Tools for creating merkle trees, generating merkle proofs, and verification of merkle proofs.",

@@ -5,0 +5,0 @@ "main": "merkletools.js",

@@ -84,2 +84,42 @@ var should = require('should');

describe("make tree with addLeaves hex", function () {
var hashes = [];
hashes.push('a292780cc748697cb499fdcc8cb89d835609f11e502281dfe3f6690b1cc23dcb');
hashes.push('cb4990b9a8936bbc137ddeb6dcab4620897b099a450ecdc5f3e86ef4b3a7135c');
var merkleTools = new merkletools();
merkleTools.addLeaves(hashes);
merkleTools.makeTree();
var targetProof0 = merkleTools.getProof(0);
var targetProof1 = merkleTools.getProof(1);
it("merkle root value should be correct", function () {
assert.equal(merkleTools.getMerkleRoot().toString('hex'), mRoot.toString('hex'));
assert.equal(targetProof0.length, 1);
assert.equal(targetProof1.length, 1);
});
});
describe("make tree with addLeaves hex", function () {
var hashes = [];
hashes.push('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae');
hashes.push('2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae');
var merkleTools = new merkletools();
merkleTools.addLeaves(hashes);
merkleTools.makeTree();
var targetProof0 = merkleTools.getProof(0);
var targetProof1 = merkleTools.getProof(1);
it("merkle root value should be correct", function () {
//assert.equal(merkleTools.getMerkleRoot().toString('hex'), 'e9fca0aee4dbbb93914ef2ef6e6da0df938fb0f29afe6ec5b875e1cee997a5c1');
assert.equal(targetProof0.length, 1);
assert.equal(targetProof1.length, 1);
});
});
describe("make tree with addLeaf buffers", function () {

@@ -86,0 +126,0 @@

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