summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNils Kenneweg <github@ovt.me>2016-06-10 00:13:48 +0200
committerGitHub <noreply@github.com>2016-06-10 00:13:48 +0200
commit1439fb2458d5ea4eeecce5cb5c52981f1d99e35d (patch)
tree2724dc0ec6d7ac94e7fb8f8ed747613642503988
parent7a46d961c675314350d570374687ef9986b0719c (diff)
parent1b00e98887cab35ff5290392f5586b493823d17a (diff)
downloadsjcl-1439fb2458d5ea4eeecce5cb5c52981f1d99e35d.zip
sjcl-1439fb2458d5ea4eeecce5cb5c52981f1d99e35d.tar.gz
sjcl-1439fb2458d5ea4eeecce5cb5c52981f1d99e35d.tar.bz2
Merge pull request #304 from ph4r05/ripemdBigHashException
Ripemd big hash exception
-rw-r--r--core/ripemd160.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/ripemd160.js b/core/ripemd160.js
index 76b60e9..0a0a536 100644
--- a/core/ripemd160.js
+++ b/core/ripemd160.js
@@ -52,6 +52,9 @@ sjcl.hash.ripemd160.prototype = {
var i, b = this._buffer = sjcl.bitArray.concat(this._buffer, data),
ol = this._length,
nl = this._length = ol + sjcl.bitArray.bitLength(data);
+ if (nl > 9007199254740991){
+ throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");
+ }
for (i = 512+ol - ((512+ol) & 511); i <= nl; i+= 512) {
var words = b.splice(0,16);
for ( var w = 0; w < 16; ++w )