September 25th, 2012, 08:07 AM
I'm (absolutely positively 100%) sure I've seen this hash function before and likewise not understood. Now I get it. Prove that it's bad! The modulus operations result in some arbitrary manipulations roughly 5 of every 6 characters in the text to hash. I once cracked an exclusive or code as one of the challenges in a programming contest. It was easy for about everyone who entered the contest. The stirring and whatnot is necessary. Roughly the correct website.
I translate to actual python as
# salt is random data per password, stored with the hashed password
key="Jonathan's awesome hash function"
input += key[:max(0,32-len(input)%32)] # make the input length a multiple of 32
hash = [ord(c) for c in key] # convert the characters to integers
for i in range(0,len(input),32):
block_32 = input[i:i+32] # grab the next 32 characters
hash = [h^ord(c) for (h,c,) in zip(hash,block_32)] # exclusive or
if hash % 2: # if odd change the data in a squirrely manner
hash = [(a+42)%256 for a in hash]
if hash % 3: # stir the pot if hash is not a multiple of 3
hash = hash[10:] + hash[:10]
[/code] are essential for python code!