Title: Message
If the validation tests pass, the problem is most likely somewhere in your code rather than in Crypto++, but I don't see right away what it could be. Try stepping through the code in the debugger on both sets of machines and find out where they start to differ and why.
----- Original Message -----
Sent: Friday, April 14, 2006 10:18 AM
Subject: RE: Endian issues with SHA?

Yes.  It passes on both sets of machines.
-----Original Message-----
From: Wei Dai [mailto:[EMAIL PROTECTED]
Sent: Friday, April 14, 2006 2:44 AM
To: [email protected]
Subject: Re: Endian issues with SHA?

Does Crypto++ pass the validation tests (cryptest.exe v) on your big-endian machines?
----- Original Message -----
Sent: Thursday, April 13, 2006 9:03 PM
Subject: Endian issues with SHA?

Hi,

           

On little-endian machines  the following code generates different results than it does on big-endian machines.

 

                byte Data[128];

                byte shaSig[20];

                for( int i = 0; i < 128; i++ )

                  {

                        Data[ i ] = i;

                  }

 

                SHA sSHA;

 

            sSHA.CalculateDigest((byte*)shaSig, (byte*)Data, 128 );

 

                printf( "SHA = " );

                for( int i=0; i<20; i++ )

                  {

                        int temp = (unsigned char)shaSig[i];

                        printf( "\\x%x", temp );

                  }

                printf( "\n" );

 

 

Little endian:  SHA =  \xe6\x43\x4b\xc4\x1\xf9\x86\x3\xd7\xed\xa5\x4\x79\xc\x98\xc6\x73\x85\xd5\x35

Big endian:  SHA = \xf3\xea\xa8\xb0\xde\x40\xc8\xcd\xbc\x53\x56\x96\xfd\x1d\x6b\xc3\x19\xaa\xbd\x21

 

(I’m running on linux with gcc 3, solaris with gcc 4, windows with VC6, and hp itanium with gcc 3, and a whole bunch of others.  I’m using cryptopp 5.2.1.)

 

This affects NR<SHA> so that a byte stream signed on one platform won’t be verified on another.  There is surely some obvious way to get the behavior I desire, but I don’t see what it is.

 

Thanks,

Bill

Reply via email to