[Pkg-javascript-commits] [node-create-hash] 19/40: normalize algs so ripemd160 works
Bastien Roucariès
rouca at moszumanska.debian.org
Sat May 27 14:10:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-create-hash.
commit 8eea641ba0ba567e35b3dd6deab3258c6befe59c
Author: Calvin Metcalf <calvin.metcalf at gmail.com>
Date: Sun Sep 27 16:38:31 2015 -0400
normalize algs so ripemd160 works
---
browser.js | 3 ++-
test.js | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/browser.js b/browser.js
index c71f73f..e9add1e 100644
--- a/browser.js
+++ b/browser.js
@@ -44,8 +44,9 @@ Hash.prototype._final = function () {
}
module.exports = function createHash (alg) {
+ alg = alg.toLowerCase()
if ('md5' === alg) return new HashNoConstructor(md5)
- if ('rmd160' === alg) return new HashNoConstructor(rmd160)
+ if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160)
return new Hash(sha(alg))
}
diff --git a/test.js b/test.js
index c326f15..0c6bd88 100644
--- a/test.js
+++ b/test.js
@@ -1,10 +1,12 @@
var fs = require('fs')
var test = require('tape')
-var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160']
+var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160', 'ripemd160']
var encodings = [/*'binary',*/ 'hex', 'base64'];
var vectors = require('hash-test-vectors')
-
+vectors.forEach(function (vector) {
+ vector.ripemd160 = vector.rmd160
+})
var createHash = require('./browser')
algorithms.forEach(function (algorithm) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-create-hash.git
More information about the Pkg-javascript-commits
mailing list