I am trying to code the md5 hash function in Python, but it does not work. I highlighted the problem for message bits that should be hashed. Yes, I actually convert every byte to bit and form a message bit (I want to learn the algorithm at the bit level). And this is where things fall apart; my bit string is malformed.
The simplest message will be ", 0 bytes long, padding will be" 1 "followed by (or not) 511" 0 "(the last 64 bits indicate the length of the message, which, as already mentioned, is simply 0).
1,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 billion
I feed 32-bit chunks of data into a conversion function at a time. I tried to manually place 1 in all positions in the first fragment, as well as in the last fragment (small end). Where should be "1"?
Thank.
Refresh . The correct position for the first 32-bit word passed into the conversion should be: 00000000000000000000000010000000which int(x,2)is equal 128, this mess is due to my A = rotL((A+F(B,C,D)+int(messageBits[0],2)+sinList[0]), s11)+Bconvert format using int()to interpret bit strings as integer data, it int()takes a binary code of binary format, so 100 ... . was a very large number.