Jason, my sample
MessageBox(SHA1("abc")=UPPER("a9993e364706816aba3e25717850c26c9cd0d89d"))
returns exactly the same result as your sample:
SHA1("abc") = A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
Where is the difference ?
>I used hashcalc initially to verify everything was correct but when I was interfacing with a Java package things did not work.
>
>The spec for the SHA-1 hash has some samples in it. This is what I used to make the corrections I mentiond. Once the changes were made I was able to interface with the Java app.
>
>The spec can be found at:
www.itl.nist.gov/fipspubs/fip180-1.htm>
>But here is the examples
>
>SHA1("abc") = A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
>SHA1("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" = 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
>
>Jason
>
>>>Andrus, after implementing this and testing, I was not getting matching results with the Java system I was interfacing with. I investigated the Secure Hash Standard at
www.itl.nist.gov/fipspubs/fip180-1.htm.
>>>
>>>I ran the test examples that were in the document and the algorithm here did not return the expected results. The problem found was that local variables do not respect the 32 bit words used in the SHA-1 algorithm.
>>
>>I tested code by comparing it with output from HashCalc (
http://www.slavasoft.com )
>>and got correct results.
>>
>>Can you publish reproducible code in which case my sha1() fails ?
>>Can you publish reproducible code where local variables do not respect 32 bit words ?
>>
>>The code i used for testing was:
>>
>>
MessageBox(SHA1("")=UPPER("da39a3ee5e6b4b0d3255bfef95601890afd80709"))
>>MessageBox(SHA1("a")=UPPER("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8"))
>>MessageBox(SHA1("abc")=UPPER("a9993e364706816aba3e25717850c26c9cd0d89d"))
>>MessageBox(SHA1("message digest")=UPPER("c12252ceda8be8994d5fa0290a47231c1d16aae3"))
>>MessageBox(SHA1("abcdefghijklmnopqrstuvwxyz")=UPPER("32d10c7b8cf96570ca04ce37f2a19d84240d3a89"))
>>MessageBox(SHA1("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")=UPPER("761c457bf73b14d27e9e9265c46f4b4dda11f940"))
>>MessageBox(SHA1(REPLICATE("1234567890",8))=UPPER("50abf5706a150990a08b2c5ea40fa0e585554732"))
>>MessageBox(SHA1("ceci est un test")=UPPER("71438dc237b45f04759c41e1b2d34f42a46318f3"))
>>
Andrus