I am implementing the SHA1 algorithm from pseudocode on wikipedia.
It says that I should add 64 bits to the original length in the message, so I tried the following:
// new_message is of type char[] and is 9+ bytes long *((__int64*)(new_message-8)) = (__int64) length;
This leads to new_message memory corruption.
Can anyone spot an error?
Thanks!
Edit:
Jesus, I'm so stupid. new_message pointed to the beginning of my array, no wonder it crashed!
source share