sha1Of() crashing and incorrect result on win64

knutaf a at b.com
Thu Mar 6 00:15:53 PST 2014


Hello,

Apologies if I have missed some rule or convention in posting 
this. I'm new to this site and to D as a whole. I do all of my 
development on Windows and in general try to keep my programs as 
64-bit unless I have a reason not to.

I tried the following simple program, but it seems to not only be 
producing the wrong answer but also crashing (as in, my 
postmortem debugger comes up when I run it).

import std.stdio;
import std.digest.sha;

void main()
{
     writefln("%s", toHexString(sha1Of("abc")));
}

Produces:
67452301EFCDAB8998BADCFE10325476C3D2E1F0

and then crashes. If I build without -m64, I get 
A9993E364706816ABA3E25717850C26C9CD0D89D, which is what I was 
expecting.

I'm also not sure how to produce the right kind of callstack or 
crash dump. I do most of my debugging with windbg, and the stack 
has a lot of scary looking mangled names that don't seem terribly 
helpful.

I found a recent changelist where the version(Win64) has SSE3 
disabled. I tried to incorporate that change locally, and it 
seems to have stopped it from crashing, but it still produces the 
wrong result.

Can anyone else reproduce this? Hopefully it is just a matter of 
me messing up something simple.

Thanks
-knutaf


More information about the Digitalmars-d mailing list