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: Chad Yates
Subject: RE: possible bug in sha and crc32 digest classes
Date: Tue, 31 Dec 2002 17:52:51 -0800

There was some discrepancies between the printed message and the actal test
(the evils of cut and paste), I'm feeling much better now.

your provided SHA1/SHA256 digests match fsum's output.  So I guess the
problem must be in VC 6.0/Win32.  thank goodness.  I'm not very familiar
with the algorithm, but I'll see if I can flush it out in the coming days.
I've almost got a linux installation with commoncpp2 setup on it so I can
test under redhat 8.0 too.

thanks for checking this out.

,Chad

P.S. here is the corrected output from the unit test:

1) test: DigestTest.testCRC32 (F) line: 111
e:\projects\c\ccgnu2_tests\digesttest.h
expected: df1dc234
but was:  00000000
additional message:
Hashed Message was 'pippo'

2) test: DigestTest.testSHA1 (F) line: 142
e:\projects\c\ccgnu2_tests\digesttest.h
expected: d012f68144ed0f121d3cc330a17eec528c2e7d59
but was:
000098440000f81e000014080000f6ec0000b9320000137d000033be0000d7cf0000dcf50000
18a3
additional message:
Hashed Message was 'pippo'

3) test: DigestTest.testSHA256 (F) line: 157
e:\projects\c\ccgnu2_tests\digesttest.h
expected: a2242ead55c94c3deb7cf2340bfef9d5bcaca22dfe66e646745ee4371c633fc8
but was:
00004ea50000c5080000a65600006e7600002405000043f80000feb000006fd4000057770000
7be3000095490000c401000064360000afda000065d20000330e
additional message:
Hashed Message was 'pippo'


> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden Behalf Of
> Elizabeth Barham
> Sent: Tuesday, December 31, 2002 4:14 PM
> To: Chad Yates
> Cc: address@hidden
> Subject: Re: possible bug in sha and crc32 digest classes
>
>
> 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:
> >
> 000098440000f81e000014080000f6ec0000b9320000137d000033be0000d7cf00
> 00dcf50000
> > 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:
> >
> 00004ea50000c5080000a65600006e7600002405000043f80000feb000006fd400
> 0057770000
> > 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
>
>
> _______________________________________________
> 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]