Comparing version 0.5.0 to 0.5.1
@@ -35,8 +35,9 @@ | ||
function feed(anyData) { | ||
if(anyData && anyData.match(that.hashResultRegexp)){ | ||
var data = String(anyData); | ||
if(data && data.match(that.hashResultRegexp)){ | ||
// Push leaf without hashing it since it is already a hash | ||
that.leaves.push(anyData); | ||
that.leaves.push(data); | ||
} | ||
else{ | ||
var hash = hashFunc(anyData); | ||
var hash = hashFunc(data); | ||
if (useUpperCaseForHash) { | ||
@@ -43,0 +44,0 @@ hash = hash.toUpperCase(); |
{ | ||
"name": "merkle", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Javascript implementation of merkle trees", | ||
@@ -5,0 +5,0 @@ "main": "merkle.js", |
@@ -50,2 +50,15 @@ # Merkle [](https://travis-ci.org/c-geek/merkle) [](http://badge.fury.io/js/merkle) [](https://github.com/c-geek/merkle/blob/master/LICENSE) | ||
### Working ONLY with lowercase | ||
For historical reasons, hashes were systematically uppercased which could lead to wrong trees (see issue [#8](https://github.com/c-geek/merkle/issues/8)). | ||
We've added an extra parameter to avoid this case alteration, so you can work exclusively with lowercase hashes: | ||
``` | ||
var use_uppercase = false; | ||
merkle('sha256', use_uppercase); | ||
``` | ||
> We plan to remove this syntax for v1.0.0 and always use lowercase hashes. | ||
### Extract tree data | ||
@@ -52,0 +65,0 @@ |
25585
453
264