sundry/python/foobar/three/hash_someone_else.py
Orien Vandenbergh d70f593d5b Add some stuffs
2016-09-09 14:25:55 -06:00

20 lines
452 B
Python

def step(digest,prev_m):
k = 0
while True:
rem = ((digest ^ prev_m) + k * 256) % 129
if rem == 0:
return ((digest ^ prev_m) + k * 256) / 129
else:
k = k + 1
def answer(digest):
prev = 0
message = []
for index, num in enumerate(digest):
if index == 0:
message.append(step(num,0))
else:
message.append(step(num,message[-1]))
return message