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!
Comment #2 by markus — 2015-01-14T21:22:45Z
It seems this got fixed in 2.066 by: std.digest.sha: disable SSSE3 for SHA because it has unsupported calling convention https://github.com/D-Programming-Language/phobos/commit/40c14681f3dd148ae4cd71c4586452ca59726144
Comment #3 by bus_dbugzilla — 2015-05-12T16:20:12Z
Cool, looks like this can be closed then.