File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11'use strict'
2- var Buffer = require ( 'safe-buffer' ) . Buffer
32var inherits = require ( 'inherits' )
4- var md5 = require ( './ md5' )
3+ var MD5 = require ( 'md5.js ' )
54var RIPEMD160 = require ( 'ripemd160' )
65var sha = require ( 'sha.js' )
7-
86var Base = require ( 'cipher-base' )
97
10- function HashNoConstructor ( hash ) {
11- Base . call ( this , 'digest' )
12-
13- this . _hash = hash
14- this . buffers = [ ]
15- }
16-
17- inherits ( HashNoConstructor , Base )
18-
19- HashNoConstructor . prototype . _update = function ( data ) {
20- this . buffers . push ( data )
21- }
22-
23- HashNoConstructor . prototype . _final = function ( ) {
24- var buf = Buffer . concat ( this . buffers )
25- var r = this . _hash ( buf )
26- this . buffers = null
27-
28- return r
29- }
30-
318function Hash ( hash ) {
329 Base . call ( this , 'digest' )
3310
@@ -46,8 +23,8 @@ Hash.prototype._final = function () {
4623
4724module . exports = function createHash ( alg ) {
4825 alg = alg . toLowerCase ( )
49- if ( alg === 'md5' ) return new HashNoConstructor ( md5 )
50- if ( alg === 'rmd160' || alg === 'ripemd160' ) return new Hash ( new RIPEMD160 ( ) )
26+ if ( alg === 'md5' ) return new MD5 ( )
27+ if ( alg === 'rmd160' || alg === 'ripemd160' ) return new RIPEMD160 ( )
5128
5229 return new Hash ( sha ( alg ) )
5330}
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2424 "homepage" : " https://github.com/crypto-browserify/createHash" ,
2525 "devDependencies" : {
2626 "hash-test-vectors" : " ^1.3.2" ,
27+ "safe-buffer" : " ^5.0.1" ,
2728 "standard" : " ^10.0.2" ,
2829 "tap-spec" : " ^2.1.2" ,
2930 "tape" : " ^4.6.3"
3031 },
3132 "dependencies" : {
3233 "cipher-base" : " ^1.0.1" ,
3334 "inherits" : " ^2.0.1" ,
34- "ripemd160 " : " ^2.0.0 " ,
35- "safe-buffer " : " ^5 .0.1" ,
35+ "md5.js " : " ^1.3.4 " ,
36+ "ripemd160 " : " ^2 .0.1" ,
3637 "sha.js" : " ^2.4.0"
3738 }
3839}
You can’t perform that action at this time.
0 commit comments