File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2926,8 +2926,15 @@ unsigned int *ComputeSHA1(unsigned char *data, int dataSize)
29262926 memcpy (msg , data , dataSize );
29272927 msg [dataSize ] = 128 ; // Write the '1' bit
29282928
2929- unsigned int bitsLen = 8 * dataSize ;
2930- msg [newDataSize - 1 ] = bitsLen ;
2929+ unsigned long long bitsLen = 8ULL * dataSize ;
2930+ msg [newDataSize - 1 ] = (unsigned char )(bitsLen );
2931+ msg [newDataSize - 2 ] = (unsigned char )(bitsLen >> 8 );
2932+ msg [newDataSize - 3 ] = (unsigned char )(bitsLen >> 16 );
2933+ msg [newDataSize - 4 ] = (unsigned char )(bitsLen >> 24 );
2934+ msg [newDataSize - 5 ] = (unsigned char )(bitsLen >> 32 );
2935+ msg [newDataSize - 6 ] = (unsigned char )(bitsLen >> 40 );
2936+ msg [newDataSize - 7 ] = (unsigned char )(bitsLen >> 48 );
2937+ msg [newDataSize - 8 ] = (unsigned char )(bitsLen >> 56 );
29312938
29322939 // Process the message in successive 512-bit chunks
29332940 for (int offset = 0 ; offset < newDataSize ; offset += (512 /8 ))
You can’t perform that action at this time.
0 commit comments