We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e963695 commit aee24f1Copy full SHA for aee24f1
hash.js
@@ -54,8 +54,13 @@ Hash.prototype.digest = function (enc) {
54
}
55
56
// to this append the block which is equal to the number l written in binary
57
- // TODO: handle case where l is > Math.pow(2, 29)
58
- this._block.writeInt32BE(l, this._blockSize - 4)
+ if (l <= 0xffffffff) {
+ this._block.writeUInt32BE(l, this._blockSize - 4)
59
+ } else {
60
+ var ll = l & 0xffffffff
61
+ this._block.writeUInt32BE((l - ll) / 0x100000000, this._blockSize - 8)
62
+ this._block.writeUInt32BE(ll, this._blockSize - 4)
63
+ }
64
65
var hash = this._update(this._block) || this._hash()
66
0 commit comments