www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12707] New: Wrong SHA1 result for SSE3 64-bit (Win?)

https://issues.dlang.org/show_bug.cgi?id=12707

          Issue ID: 12707
           Summary: Wrong SHA1 result for SSE3 64-bit (Win?)
           Product: D
           Version: unspecified
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: cbkbbejeap mailinator.com

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.

--
May 05 2014