Further cleanup of hash module
This commit is contained in:
parent
d67efe22eb
commit
c840fabc7d
|
@ -1,5 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* @requires crypto/hash/sha
|
* @requires crypto/hash/sha
|
||||||
|
* @requires crypto/hash/md5
|
||||||
|
* @requires crypto/hash/ripe-md
|
||||||
* @requires util
|
* @requires util
|
||||||
* @module crypto/hash
|
* @module crypto/hash
|
||||||
*/
|
*/
|
||||||
|
@ -10,6 +12,8 @@ var sha = require('./sha.js'),
|
||||||
asmCrypto = require('asmcrypto'),
|
asmCrypto = require('asmcrypto'),
|
||||||
Rusha = require('rusha'),
|
Rusha = require('rusha'),
|
||||||
rusha = new Rusha(),
|
rusha = new Rusha(),
|
||||||
|
md5 = require('./md5.js'),
|
||||||
|
ripemd = require('./ripe-md.js'),
|
||||||
util = require('../../util.js'),
|
util = require('../../util.js'),
|
||||||
nodeCrypto = util.getNodeCrypto(),
|
nodeCrypto = util.getNodeCrypto(),
|
||||||
Buffer = util.getNodeBuffer();
|
Buffer = util.getNodeBuffer();
|
||||||
|
@ -39,26 +43,21 @@ if(nodeCrypto) { // Use Node native crypto for all hash functions
|
||||||
|
|
||||||
hash_fns = {
|
hash_fns = {
|
||||||
/** @see module:crypto/hash/md5 */
|
/** @see module:crypto/hash/md5 */
|
||||||
md5: require('./md5.js'),
|
md5: md5,
|
||||||
/** @see module:crypto/hash/sha.sha1 */
|
/** @see module:rusha */
|
||||||
/** @see module:crypto/hash/rusha */
|
sha1: function(data) {
|
||||||
// sha1: sha.sha1,
|
|
||||||
sha1: function (data) {
|
|
||||||
return util.str2Uint8Array(util.hex2bin(rusha.digest(data)));
|
return util.str2Uint8Array(util.hex2bin(rusha.digest(data)));
|
||||||
},
|
},
|
||||||
//sha1: asmCrypto.SHA1.bytes,
|
|
||||||
/** @see module:crypto/hash/sha.sha224 */
|
/** @see module:crypto/hash/sha.sha224 */
|
||||||
sha224: sha.sha224,
|
sha224: sha.sha224,
|
||||||
/** @see module:crypto/hash/sha.sha256 */
|
/** @see module:asmcrypto */
|
||||||
/** @see module:crypto/asmcrypto */
|
|
||||||
//sha256: sha.sha256,
|
|
||||||
sha256: asmCrypto.SHA256.bytes,
|
sha256: asmCrypto.SHA256.bytes,
|
||||||
/** @see module:crypto/hash/sha.sha384 */
|
/** @see module:crypto/hash/sha.sha384 */
|
||||||
sha384: sha.sha384,
|
sha384: sha.sha384,
|
||||||
/** @see module:crypto/hash/sha.sha512 */
|
/** @see module:crypto/hash/sha.sha512 */
|
||||||
sha512: sha.sha512,
|
sha512: sha.sha512,
|
||||||
/** @see module:crypto/hash/ripe-md */
|
/** @see module:crypto/hash/ripe-md */
|
||||||
ripemd: require('./ripe-md.js')
|
ripemd: ripemd
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user