bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: possible bug in sha and crc32 digest classes


From: Elizabeth Barham
Subject: Re: possible bug in sha and crc32 digest classes
Date: 31 Dec 2002 18:13:46 -0600

Hi Chad,

   The "expected" answers provided in your message for the SHA1Digest
and SHA256Digest are for the message "abc" and are the same in the SHA
specs.

CommonC++ SHA1Digest and SHA156Digest of "abc", respectivly:
a9993e364706816aba3e25717850c26c9cd0d89d
ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad

CommonC++ SHA1Digest and SHA156Digest of "pippo", respectivly:
d012f68144ed0f121d3cc330a17eec528c2e7d59
a2242ead55c94c3deb7cf2340bfef9d5bcaca22dfe66e646745ee4371c633fc8

   How do these answers compare with that of fsum?

   As for the extraneous zeros, though, that must be a VC++ issue. The
test case output is from commoncpp2-1.0.7 using g++.

   Elizabeth


Chad Yates <address@hidden> writes:

> While building a cppunit test suite for the digest classes I exposed some
> possible bugs.  I cannot get correct digests for CRC32 and the two SHA
> classes I'm testing (SHA1 & SHA256).  I used a freely available command line
> hashing program (fsum) to generate my expected hash values, and have
> verified that fsum generates a correct hash for the sha256 reference message
> of 'abc' as documented in the sha256 literature.  My other test cases for
> Checksum, CRC16, and MD5 test out ok, and I am only testing SHA1 and SHA256
> at this time.
> 
> here are the failures from my cppunit test suite -- I kept 'pippo' as a
> message in honor of the person that wrote the digest test program :)
> 
> 1) test: DigestTest.testCRC32 (F) line: 111
> e:\projects\c\ccgnu2_tests\digesttest.h
> expected: df1dc234
> but was:  00000000
> additional message:
> Source Message was 'pippo'
> 
> 2) test: DigestTest.testSHA1 (F) line: 142
> e:\projects\c\ccgnu2_tests\digesttest.h
> expected: a9993e364706816aba3e25717850c26c9cd0d89d
> but was:
> 000098440000f81e000014080000f6ec0000b9320000137d000033be0000d7cf0000dcf50000
> 18a3
> additional message:
> Source Message was 'pippo'
> 
> 3) test: DigestTest.testSHA256 (F) line: 157
> e:\projects\c\ccgnu2_tests\digesttest.h
> expected: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
> but was:
> 00004ea50000c5080000a65600006e7600002405000043f80000feb000006fd4000057770000
> 7be3000095490000c401000064360000afda000065d20000330e
> additional message:
> Source Message was 'pippo'
> 
> I suspect the error in crc32 may be the stream extract function and not the
> actual algorithm.
> 
> I'm using M$ Visual C++ 6.0 and would like to see if this problem also
> exists on the unix versions before I dig deeper.
> 
> ,chad
> 
> 
> 
> 
> _______________________________________________
> Bug-commoncpp mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-commoncpp



reply via email to

[Prev in Thread] Current Thread [Next in Thread]