File tree Expand file tree Collapse file tree 7 files changed +8
-8
lines changed Expand file tree Collapse file tree 7 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var Buffer = require('safe-buffer').Buffer
22
33// prototype class for hash functions
44function Hash ( blockSize , finalSize ) {
5- this . _block = new Buffer ( blockSize )
5+ this . _block = Buffer . alloc ( blockSize )
66 this . _finalSize = finalSize
77 this . _blockSize = blockSize
88 this . _len = 0
@@ -11,7 +11,7 @@ function Hash (blockSize, finalSize) {
1111Hash . prototype . update = function ( data , enc ) {
1212 if ( typeof data === 'string' ) {
1313 enc = enc || 'utf8'
14- data = new Buffer ( data , enc )
14+ data = Buffer . from ( data , enc )
1515 }
1616
1717 var block = this . _block
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ Sha.prototype._update = function (M) {
8080}
8181
8282Sha . prototype . _hash = function ( ) {
83- var H = new Buffer ( 20 )
83+ var H = Buffer . allocUnsafe ( 20 )
8484
8585 H . writeInt32BE ( this . _a | 0 , 0 )
8686 H . writeInt32BE ( this . _b | 0 , 4 )
Original file line number Diff line number Diff line change @@ -85,7 +85,7 @@ Sha1.prototype._update = function (M) {
8585}
8686
8787Sha1 . prototype . _hash = function ( ) {
88- var H = new Buffer ( 20 )
88+ var H = Buffer . allocUnsafe ( 20 )
8989
9090 H . writeInt32BE ( this . _a | 0 , 0 )
9191 H . writeInt32BE ( this . _b | 0 , 4 )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Sha224.prototype.init = function () {
3737}
3838
3939Sha224 . prototype . _hash = function ( ) {
40- var H = new Buffer ( 28 )
40+ var H = Buffer . allocUnsafe ( 28 )
4141
4242 H . writeInt32BE ( this . _a , 0 )
4343 H . writeInt32BE ( this . _b , 4 )
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ Sha256.prototype._update = function (M) {
118118}
119119
120120Sha256 . prototype . _hash = function ( ) {
121- var H = new Buffer ( 32 )
121+ var H = Buffer . allocUnsafe ( 32 )
122122
123123 H . writeInt32BE ( this . _a , 0 )
124124 H . writeInt32BE ( this . _b , 4 )
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Sha384.prototype.init = function () {
3737}
3838
3939Sha384 . prototype . _hash = function ( ) {
40- var H = new Buffer ( 48 )
40+ var H = Buffer . allocUnsafe ( 48 )
4141
4242 function writeInt64BE ( h , l , offset ) {
4343 H . writeInt32BE ( h , offset )
Original file line number Diff line number Diff line change @@ -238,7 +238,7 @@ Sha512.prototype._update = function (M) {
238238}
239239
240240Sha512 . prototype . _hash = function ( ) {
241- var H = new Buffer ( 64 )
241+ var H = Buffer . allocUnsafe ( 64 )
242242
243243 function writeInt64BE ( h , l , offset ) {
244244 H . writeInt32BE ( h , offset )
You can’t perform that action at this time.
0 commit comments