Progressive hashing of SHA512 yields different results on same data (Chrome only)
Closed this issue · 5 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
// tested with:
// count = 32768
// salt = "86846685d7a70051111b959"
// salt2 = "l9qAaa7Q"
// a_Password = "tester"
var preHash = CryptoJS.SHA512(salt + a_Password).toString();
var hash = CryptoJS.SHA512(salt2 + preHash);
var roundHash = CryptoJS.algo.SHA512.create();
do {
roundHash.update( hash );
roundHash.update( preHash );
hash = roundHash.finalize();
roundHash.reset();
} while (--count);
alert( hash.toString() );
What is the expected output? What do you see instead?
The value showed in the alert window differs every time this codeblock is
re-run.
It does *not* differ when a breakpoint is hit at least once inside the loop
(browser bug?).
This happens with Chrome, not on Firefox.
The php based version showed the result produced with a breakpoint is correct:
$preHash = hash('sha512', $salt.$a_Password);
$hash = hash('sha512', $salt2.$preHash, true);
do {
$hash = hash('sha512', $hash.$preHash, true);
} while (--$count);
echo bin2hex($hash);
What version of the product are you using? On what operating system?
CryptoJS 3.1.2
Tested NOT WORKING with Chrome 25.0.1364.58
Tested WORKING with Firefox 15.0.1
Original issue reported on code.google.com by arne.cl...@gmail.com
on 3 Feb 2013 at 12:28
GoogleCodeExporter commented
Note that this happend on a beta version of Chrome.
Chrome 24 (latest release version) does not show the problem.
So this might become a non-issue once Chrome 25 is coming out of beta.
Original comment by arne.cl...@gmail.com
on 3 Feb 2013 at 12:40
GoogleCodeExporter commented
Since this issue does not occur in any other browser, including the current
stable build of Chrome, this seems to be a browser bug in a beta build. If this
issue eventually occurs in the stable build, then I'll look into a workaround.
Otherwise, this issue is more appropriately reported to Chrome.
Original comment by Jeff.Mott.OR
on 3 Feb 2013 at 1:15
- Changed state: Invalid
GoogleCodeExporter commented
I opened a chrome bug for this one
http://code.google.com/p/chromium/issues/detail?id=173907
Original comment by arne.cl...@gmail.com
on 3 Feb 2013 at 4:14
GoogleCodeExporter commented
Confirmed and fixed by the Chrome Team.
Original comment by arne.cl...@gmail.com
on 7 Feb 2013 at 8:48
GoogleCodeExporter commented
Fantastic! Thanks for following through. :)
Original comment by Jeff.Mott.OR
on 7 Feb 2013 at 11:08