bug-commoncpp
[Top][All Lists]
Advanced

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

possible bug in sha and crc32 digest classes


From: Chad Yates
Subject: possible bug in sha and crc32 digest classes
Date: Tue, 31 Dec 2002 10:34:44 -0800

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





reply via email to

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