Bug 12707 – Wrong SHA1 result for SSE3 64-bit (Win?)
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2014-05-05T22:13:00Z
Last change time
2015-06-09T01:31:21Z
Assigned to
nobody
Creator
bus_dbugzilla
Comments
Comment #0 by bus_dbugzilla — 2014-05-05T22:13:42Z
The following works for 32-bit, but fails on 64-bit (at least on Win64, I wasn't able to test 64-bit on non-Windows):
----------------------------------
import std.digest.sha;
void main()
{
auto plainText = "hello world";
enum expectedHash = cast(ubyte[20]) x"2aae6c35c94fcfb415dbe95f408b9ce91ee846ed";
assert(sha1Of(plainText) == expectedHash);
}
----------------------------------
If I modify std.digest.sha to disable the SSE3 version, then 64-bit works.
I tested this using DMD 2.065.0. Not sure what other versions may be affected.
Comment #1 by kf6kjg+dlang — 2014-08-29T04:07:12Z
Looks like it might be fixed (or at least bypassed) in 2.066.0. At least in my code it no longer returns the same value across multiple inputs!