The lines that I am not sure about are commented.
input ← “string to be hashed”
key ← “Hamilton's awesome hash function”
//pad input to ensure the length is a multiple of 32
//this will append the necessary number of bytes from
// the beginning of the key
if length(input) == 0 || length(input) % 32:
input += key[:32-length(input)%32] // HERE IS AN INSTANCE!!!
hash ← key
for block_32 in input: //break input into 32-byte blocks
hash ← hash xor block_32
if hash[0] % 2:
for i in [0, 32):
//increment each byte by 42 (modulo 256)
hash[i] ← (hash[i] + 42) % 256
if hash[1] % 3:
//move the first 10 bytes to the end
hash ← hash[10:] + hash[:10] // HERE IS ANOTHER INSTANCE!!!
//your hash may contain non-printable characters, so make
// sure you hex encode it
print hex(hash)
Thanks for the help! I'm sure that this will clear up the issues that I am having understanding this algorithm.

New Topic/Question
Reply



MultiQuote








|