Skip to content

Commit

Permalink
Fix core so that HMAC-SHA224/384 work correctly
Browse files Browse the repository at this point in the history
The 256/512 variants already were correct, but the 224/384 did not
and gave differing values when compared to Python's hmac library.

The bug appears to have be detected on 2013-03-17 according to a post
titled:

Issue 84: HmacSHA224 and HmacSHA384 give incorrect output

https://code.google.com/p/crypto-js/issues/detail?id=84

Signed-off-by: Christopher Hall <hsw@ms2.hinet.net>
  • Loading branch information
hxw committed Oct 4, 2014
1 parent 8d4a2d3 commit 81077c0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,11 @@ var CryptoJS = CryptoJS || (function (Math, undefined) {
var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;
thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);
}
} else if (thatWords.length > 0xffff) {
} else {
// Copy one word at a time
for (var i = 0; i < thatSigBytes; i += 4) {
thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];
}
} else {
// Copy all words at once
thisWords.push.apply(thisWords, thatWords);
}
this.sigBytes += thatSigBytes;

Expand Down

0 comments on commit 81077c0

Please sign in to comment.