From ef7c13ce1a9f05f87bf3f457382054aeb4a3d204 Mon Sep 17 00:00:00 2001 From: Roderik van der Veer Date: Tue, 27 Mar 2018 20:54:38 +0200 Subject: [PATCH] fix: remove dist files --- .gitignore | 2 +- dist/benchmark.d.ts | 1 - dist/benchmark.js | 35 ---- dist/benchmark.js.map | 1 - dist/merkletools.d.ts | 145 ----------------- dist/merkletools.js | 346 ---------------------------------------- dist/merkletools.js.map | 1 - 7 files changed, 1 insertion(+), 530 deletions(-) delete mode 100644 dist/benchmark.d.ts delete mode 100644 dist/benchmark.js delete mode 100644 dist/benchmark.js.map delete mode 100644 dist/merkletools.d.ts delete mode 100644 dist/merkletools.js delete mode 100644 dist/merkletools.js.map diff --git a/.gitignore b/.gitignore index 7c3b9d6..c1fd5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ npm-debug.log* pids *.pid *.seed - +dist/ # Directory for instrumented libs generated by jscoverage/JSCover lib-cov diff --git a/dist/benchmark.d.ts b/dist/benchmark.d.ts deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/benchmark.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/benchmark.js b/dist/benchmark.js deleted file mode 100644 index 0f9156d..0000000 --- a/dist/benchmark.js +++ /dev/null @@ -1,35 +0,0 @@ -'use strict'; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const benchmark_1 = __importDefault(require("benchmark")); -const crypto_1 = __importDefault(require("crypto")); -const merkletools_1 = __importDefault(require("./merkletools")); -const suite = new benchmark_1.default.Suite(); -const merkleTools = new merkletools_1.default(); -const leafCount = 75000; -const leaves = []; -// generate random hashes to use as leaves -for (let x = 0; x < leafCount; x++) { - leaves.push(crypto_1.default.randomBytes(32).toString('hex')); -} -// add test to populate leaves, build tree, generate proofs, and reset tree -suite - .add(leafCount + 'leaves', function () { - merkleTools.addLeaves(leaves); // add random leaves to tree - merkleTools.makeTree(); // build the merkle tree - for (let x = 0; x < leafCount; x++) { - // generate the merkle proofs for each leaf - merkleTools.getProof(x); - } - merkleTools.resetTree(); // clear the tree -}) - .on('cycle', function (event) { - console.log(String(event.target)); -}) - .on('complete', function () { - console.log(this[0].stats); -}) - .run({ async: true }); -//# sourceMappingURL=benchmark.js.map \ No newline at end of file diff --git a/dist/benchmark.js.map b/dist/benchmark.js.map deleted file mode 100644 index aef76d1..0000000 --- a/dist/benchmark.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"benchmark.js","sourceRoot":"","sources":["../src/benchmark.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;AAEb,0DAAkC;AAClC,oDAA4B;AAC5B,gEAAwC;AAExC,MAAM,KAAK,GAAG,IAAI,mBAAS,CAAC,KAAK,EAAE,CAAC;AAEpC,MAAM,WAAW,GAAG,IAAI,qBAAW,EAAE,CAAC;AAEtC,MAAM,SAAS,GAAG,KAAK,CAAC;AACxB,MAAM,MAAM,GAAG,EAAE,CAAC;AAClB,0CAA0C;AAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;IAClC,MAAM,CAAC,IAAI,CAAC,gBAAM,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;CACrD;AAED,2EAA2E;AAC3E,KAAK;KACF,GAAG,CAAC,SAAS,GAAG,QAAQ,EAAE;IACzB,WAAW,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;IAC3D,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,wBAAwB;IAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;QAClC,2CAA2C;QAC3C,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACzB;IACD,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC,iBAAiB;AAC5C,CAAC,CAAC;KACD,EAAE,CAAC,OAAO,EAAE,UAAS,KAAK;IACzB,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACpC,CAAC,CAAC;KACD,EAAE,CAAC,UAAU,EAAE;IACd,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC,CAAC;KACD,GAAG,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/merkletools.d.ts b/dist/merkletools.d.ts deleted file mode 100644 index 52e176b..0000000 --- a/dist/merkletools.d.ts +++ /dev/null @@ -1,145 +0,0 @@ -/// -export interface ITreeOptions { - hashType: string; -} -export interface ISibling { - left?: string; - right?: string; -} -export default class MerkleTools { - private hashType; - private tree; - constructor(treeOptions?: ITreeOptions); - /** - * Resets the current tree to empty - */ - resetTree(): void; - /** - * Add a leaf to the tree. - * Accepts hash value as a Buffer or hex string - * - * @param {(string | Buffer)} value the value to be added to the tree - * @param {boolean} [doHash=false] should the value be hashed first? - * @memberof MerkleTools - */ - addLeaf(value: string | Buffer, doHash?: boolean): void; - /** - * Add a leaves to the tree - * Accepts hash values as an array of Buffers or hex strings - * - * @param {(Array)} valuesArray and array with values - * @param {boolean} [doHash=false] should the values be hashed first? - * @memberof MerkleTools - */ - addLeaves(valuesArray: Array, doHash?: boolean): void; - /** - * Returns a leaf at the given index - * - * @param {number} index the index of the leaf - * @returns {Buffer} the leaf - * @memberof MerkleTools - */ - getLeaf(index: number): Buffer; - /** - * Returns the number of leaves added to the tree - * - * @returns {number} the number of leaves added to the tree - * @memberof MerkleTools - */ - getLeafCount(): number; - /** - * Returns the ready state of the tree - * - * @returns {boolean} is the tree ready? - * @memberof MerkleTools - */ - getTreeReadyState(): boolean; - /** - * Generates the merkle tree - * - * @param {boolean} [doubleHash=false] - * @memberof MerkleTools - */ - makeTree(doubleHash?: boolean): void; - /** - * Generates a Bitcoin style merkle tree - * - * @param {boolean} [doubleHash=false] - * @memberof MerkleTools - */ - makeBTCTree(doubleHash?: boolean): void; - /** - * Returns the merkle root value for the tree - * - * @returns {Buffer} - * @memberof MerkleTools - */ - getMerkleRoot(): Buffer; - /** - * Returns the proof for a leaf at the given index as an array of merkle siblings in hex format - * - * @param {number} index - * @returns {(Array)} - * @memberof MerkleTools - */ - getProof(index: number): ISibling[]; - /** - * Takes a proof array, a target hash value, and a merkle root - * Checks the validity of the proof and return true or false - * - * @param {Array} proof - * @param {(Buffer | string)} targetHash - * @param {(Buffer | string)} merkleRoot - * @param {boolean} [doubleHash=false] - * @returns {boolean} - * @memberof MerkleTools - */ - validateProof(proof: ISibling[], targetHash: Buffer | string, merkleRoot: Buffer | string, doubleHash?: boolean): boolean; - /** - * Hashes the value using the provided algorithm - * - * @private - * @param {(string | Buffer)} value the value to be hashed - * @returns {Buffer} the hashed value as a buffer - * @memberof MerkleTools - */ - private hashFunction(value); - /** - * Internally, trees are made of nodes containing Buffer values only. This helps ensure that leaves - * being added are Buffers, and will convert hex to Buffer if needed - * - * @private - * @param {(string | Buffer)} value - * @returns {Buffer} - * @memberof MerkleTools - */ - private getBuffer(value); - /** - * Checks if the value is a hex - * - * @private - * @param {string} value the value to check - * @returns {boolean} if the value is a hex - * @memberof MerkleTools - */ - private isHex(value); - /** - * Calculates the next level of node when building the merkle tree - * These values are calcalated off of the current highest level, level 0 and will be prepended to the levels array - * - * @private - * @param {boolean} [doubleHash=false] - * @returns {Buffer[]} - * @memberof MerkleTools - */ - private calculateNextLevel(doubleHash?); - /** - * This version uses the BTC method of duplicating the odd ending nodes - * - * @private - * @param {boolean} [doubleHash=false] - * @returns {Buffer[]} - * @memberof MerkleTools - */ - private calculateBTCNextLevel(doubleHash?); -} diff --git a/dist/merkletools.js b/dist/merkletools.js deleted file mode 100644 index 57f704a..0000000 --- a/dist/merkletools.js +++ /dev/null @@ -1,346 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -/* Copyright 2017 Tierion / Modified by SettleMint in 2018 -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -const crypto_1 = __importDefault(require("crypto")); -const js_sha3_1 = require("js-sha3"); -class MerkleTools { - constructor(treeOptions = { hashType: 'sha256' }) { - this.tree = { - isReady: false, - leaves: [], - levels: [] - }; - this.hashType = treeOptions.hashType; - } - /** - * Resets the current tree to empty - */ - resetTree() { - this.tree = { - isReady: false, - leaves: [], - levels: [] - }; - } - /** - * Add a leaf to the tree. - * Accepts hash value as a Buffer or hex string - * - * @param {(string | Buffer)} value the value to be added to the tree - * @param {boolean} [doHash=false] should the value be hashed first? - * @memberof MerkleTools - */ - addLeaf(value, doHash = false) { - this.tree.isReady = false; - if (doHash) { - value = this.hashFunction(value); - } - this.tree.leaves.push(this.getBuffer(value)); - } - /** - * Add a leaves to the tree - * Accepts hash values as an array of Buffers or hex strings - * - * @param {(Array)} valuesArray and array with values - * @param {boolean} [doHash=false] should the values be hashed first? - * @memberof MerkleTools - */ - addLeaves(valuesArray, doHash = false) { - valuesArray.forEach(value => { - this.addLeaf(value, doHash); - }); - } - /** - * Returns a leaf at the given index - * - * @param {number} index the index of the leaf - * @returns {Buffer} the leaf - * @memberof MerkleTools - */ - getLeaf(index) { - if (index < 0 || index > this.tree.leaves.length - 1) { - return null; // index is out of array bounds - } - return this.tree.leaves[index]; - } - /** - * Returns the number of leaves added to the tree - * - * @returns {number} the number of leaves added to the tree - * @memberof MerkleTools - */ - getLeafCount() { - return this.tree.leaves.length; - } - /** - * Returns the ready state of the tree - * - * @returns {boolean} is the tree ready? - * @memberof MerkleTools - */ - getTreeReadyState() { - return this.tree.isReady; - } - /** - * Generates the merkle tree - * - * @param {boolean} [doubleHash=false] - * @memberof MerkleTools - */ - makeTree(doubleHash = false) { - this.tree.isReady = false; - const leafCount = this.tree.leaves.length; - if (leafCount > 0) { - // skip this whole process if there are no leaves added to the tree - this.tree.levels = []; - this.tree.levels.unshift(this.tree.leaves); - while (this.tree.levels[0].length > 1) { - this.tree.levels.unshift(this.calculateNextLevel(doubleHash)); - } - } - this.tree.isReady = true; - } - /** - * Generates a Bitcoin style merkle tree - * - * @param {boolean} [doubleHash=false] - * @memberof MerkleTools - */ - makeBTCTree(doubleHash = false) { - this.tree.isReady = false; - const leafCount = this.tree.leaves.length; - if (leafCount > 0) { - // skip this whole process if there are no leaves added to the tree - this.tree.levels = []; - this.tree.levels.unshift(this.tree.leaves); - while (this.tree.levels[0].length > 1) { - this.tree.levels.unshift(this.calculateBTCNextLevel(doubleHash)); - } - } - this.tree.isReady = true; - } - /** - * Returns the merkle root value for the tree - * - * @returns {Buffer} - * @memberof MerkleTools - */ - getMerkleRoot() { - if (!this.tree.isReady || this.tree.levels.length === 0) { - return null; - } - return this.tree.levels[0][0]; - } - /** - * Returns the proof for a leaf at the given index as an array of merkle siblings in hex format - * - * @param {number} index - * @returns {(Array)} - * @memberof MerkleTools - */ - getProof(index) { - if (!this.tree.isReady) { - return null; - } - const currentRowIndex = this.tree.levels.length - 1; - if (index < 0 || index > this.tree.levels[currentRowIndex].length - 1) { - return null; - } // the index it out of the bounds of the leaf array - const proof = []; - for (let x = currentRowIndex; x > 0; x--) { - const currentLevelNodeCount = this.tree.levels[x].length; - // skip if this is an odd end node - if (index === currentLevelNodeCount - 1 && - currentLevelNodeCount % 2 === 1) { - index = Math.floor(index / 2); - continue; - } - // determine the sibling for the current index and get its value - const isRightNode = index % 2; - const siblingIndex = isRightNode ? index - 1 : index + 1; - const sibling = {}; - const siblingPosition = isRightNode ? 'left' : 'right'; - const siblingValue = this.tree.levels[x][siblingIndex].toString('hex'); - sibling[siblingPosition] = siblingValue; - proof.push(sibling); - index = Math.floor(index / 2); // set index to the parent index - } - return proof; - } - /** - * Takes a proof array, a target hash value, and a merkle root - * Checks the validity of the proof and return true or false - * - * @param {Array} proof - * @param {(Buffer | string)} targetHash - * @param {(Buffer | string)} merkleRoot - * @param {boolean} [doubleHash=false] - * @returns {boolean} - * @memberof MerkleTools - */ - validateProof(proof, targetHash, merkleRoot, doubleHash = false) { - targetHash = this.getBuffer(targetHash); - merkleRoot = this.getBuffer(merkleRoot); - if (proof.length === 0) { - return targetHash.toString('hex') === merkleRoot.toString('hex'); // no siblings, single item tree, so the hash should also be the root - } - let proofHash = targetHash; - for (const leaf of proof) { - if (leaf.left) { - // then the sibling is a left node - if (doubleHash) { - proofHash = this.hashFunction(this.hashFunction(Buffer.concat([this.getBuffer(leaf.left), proofHash]))); - } - else { - proofHash = this.hashFunction(Buffer.concat([this.getBuffer(leaf.left), proofHash])); - } - } - else if (leaf.right) { - // then the sibling is a right node - if (doubleHash) { - proofHash = this.hashFunction(this.hashFunction(Buffer.concat([proofHash, this.getBuffer(leaf.right)]))); - } - else { - proofHash = this.hashFunction(Buffer.concat([proofHash, this.getBuffer(leaf.right)])); - } - } - else { - // no left or right designation exists, proof is invalid - return false; - } - } - return proofHash.toString('hex') === merkleRoot.toString('hex'); - } - /** - * Hashes the value using the provided algorithm - * - * @private - * @param {(string | Buffer)} value the value to be hashed - * @returns {Buffer} the hashed value as a buffer - * @memberof MerkleTools - */ - hashFunction(value) { - switch (this.hashType) { - case 'SHA3-224': - return Buffer.from(js_sha3_1.sha3_224.update(value).array()); - case 'SHA3-256': - return Buffer.from(js_sha3_1.sha3_256.update(value).array()); - case 'SHA3-384': - return Buffer.from(js_sha3_1.sha3_384.update(value).array()); - case 'SHA3-512': - return Buffer.from(js_sha3_1.sha3_512.update(value).array()); - default: - return crypto_1.default - .createHash(this.hashType) - .update(value) - .digest(); - } - } - /** - * Internally, trees are made of nodes containing Buffer values only. This helps ensure that leaves - * being added are Buffers, and will convert hex to Buffer if needed - * - * @private - * @param {(string | Buffer)} value - * @returns {Buffer} - * @memberof MerkleTools - */ - getBuffer(value) { - if (value instanceof Buffer) { - // we already have a buffer, so return it - return value; - } - else if (this.isHex(value)) { - // the value is a hex string, convert to buffer and return - return Buffer.from(value, 'hex'); - } - else { - // the value is neither buffer nor hex string, will not process this, throw error - throw new Error("Bad hex value - '" + value + "'"); - } - } - /** - * Checks if the value is a hex - * - * @private - * @param {string} value the value to check - * @returns {boolean} if the value is a hex - * @memberof MerkleTools - */ - isHex(value) { - const hexRegex = /^[0-9A-Fa-f]{2,}$/; - return hexRegex.test(value); - } - /** - * Calculates the next level of node when building the merkle tree - * These values are calcalated off of the current highest level, level 0 and will be prepended to the levels array - * - * @private - * @param {boolean} [doubleHash=false] - * @returns {Buffer[]} - * @memberof MerkleTools - */ - calculateNextLevel(doubleHash = false) { - const nodes = []; - const topLevel = this.tree.levels[0]; - const topLevelCount = topLevel.length; - for (let x = 0; x < topLevelCount; x += 2) { - if (x + 1 <= topLevelCount - 1) { - // concatenate and hash the pair, add to the next level array, doubleHash if requested - if (doubleHash) { - nodes.push(this.hashFunction(this.hashFunction(Buffer.concat([topLevel[x], topLevel[x + 1]])))); - } - else { - nodes.push(this.hashFunction(Buffer.concat([topLevel[x], topLevel[x + 1]]))); - } - } - else { - // this is an odd ending node, promote up to the next level by itself - nodes.push(topLevel[x]); - } - } - return nodes; - } - /** - * This version uses the BTC method of duplicating the odd ending nodes - * - * @private - * @param {boolean} [doubleHash=false] - * @returns {Buffer[]} - * @memberof MerkleTools - */ - calculateBTCNextLevel(doubleHash = false) { - const nodes = []; - const topLevel = this.tree.levels[0]; - const topLevelCount = topLevel.length; - if (topLevelCount % 2 === 1) { - // there is an odd count, duplicate the last element - topLevel.push(topLevel[topLevelCount - 1]); - } - for (let x = 0; x < topLevelCount; x += 2) { - // concatenate and hash the pair, add to the next level array, doubleHash if requested - if (doubleHash) { - nodes.push(this.hashFunction(this.hashFunction(Buffer.concat([topLevel[x], topLevel[x + 1]])))); - } - else { - nodes.push(this.hashFunction(Buffer.concat([topLevel[x], topLevel[x + 1]]))); - } - } - return nodes; - } -} -exports.default = MerkleTools; -//# sourceMappingURL=merkletools.js.map \ No newline at end of file diff --git a/dist/merkletools.js.map b/dist/merkletools.js.map deleted file mode 100644 index de4af0d..0000000 --- a/dist/merkletools.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"merkletools.js","sourceRoot":"","sources":["../src/merkletools.ts"],"names":[],"mappings":";;;;;AAAA;;;;;;;;;;EAUE;AACF,oDAA4B;AAC5B,qCAA0E;AAiB1E;IAQE,YAAY,cAA4B,EAAE,QAAQ,EAAE,QAAQ,EAAE;QANtD,SAAI,GAAU;YACpB,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX,CAAC;QAGA,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,QAAQ,CAAC;IACvC,CAAC;IAED;;OAEG;IACI,SAAS;QACd,IAAI,CAAC,IAAI,GAAG;YACV,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;SACX,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACI,OAAO,CAAC,KAAsB,EAAE,SAAkB,KAAK;QAC5D,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAC1B,IAAI,MAAM,EAAE;YACV,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;SAClC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;;OAOG;IACI,SAAS,CACd,WAAmC,EACnC,SAAkB,KAA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