Differences between MD5 and SHA1 hash digests Endianness #57

Open
opened 2020-10-22 05:38:04 -05:00 by jackyalbo · 4 comments
jackyalbo commented 2020-10-22 05:38:04 -05:00 (Migrated from github.com)

As part of using both MD5 and SHA1 hashes in our project it seems that there is a difference in the Endianness between them: it seems that digest words for SHA1 are big-endian, while MD5 ones are little-endian.
Is that really the case? and if so, why? as we want to use the same code for both it caused it to fail constantly for SHA1

As part of using both MD5 and SHA1 hashes in our project it seems that there is a difference in the Endianness between them: it seems that digest words for SHA1 are big-endian, while MD5 ones are little-endian. Is that really the case? and if so, why? as we want to use the same code for both it caused it to fail constantly for SHA1
jackyalbo commented 2020-10-22 06:15:42 -05:00 (Migrated from github.com)
The change we needed to add in our code https://github.com/noobaa/noobaa-core/blob/540d5e587af47188b9bea84d4a0525eac87825ff/src/native/tools/ssl_napi.cpp#L137
gbtucker commented 2020-10-22 14:02:49 -05:00 (Migrated from github.com)

Yes, sorry for the inconsistency but you are correct. Looking at the code in ssl_napi.c, does hashing always go through the submit_and_flush() function? If so, you may not be getting the possible throughput improvement if you can maintain multiple outstanding jobs. I only looked at the Hasher class members though.

Yes, sorry for the inconsistency but you are correct. Looking at the code in ssl_napi.c, does hashing always go through the submit_and_flush() function? If so, you may not be getting the possible throughput improvement if you can maintain multiple outstanding jobs. I only looked at the `Hasher` class members though.
guymguym commented 2020-10-22 15:41:52 -05:00 (Migrated from github.com)

Hey @gbtucker
You're right - we still use a single buffer in our code.
See here for context https://github.com/intel/isa-l_crypto/issues/45#issuecomment-638277664

Hey @gbtucker You're right - we still use a single buffer in our code. See here for context https://github.com/intel/isa-l_crypto/issues/45#issuecomment-638277664
gbtucker commented 2020-10-22 16:27:22 -05:00 (Migrated from github.com)

Oh, didn't realize they were linked. Let me know if I can help with multi-flight.

Oh, didn't realize they were linked. Let me know if I can help with multi-flight.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-intel/isa-l_crypto#57
No description provided.