I am trying to “discover” what was the value of a variable UNKNOWN
when it was created hash_res
.
The only information that was provided to me was that the following lines were used:
random.seed(UNKNOWN+hash(CONST_VAR))
hash_res = random.randint(1<<32, 1<<40)
Plus value CONST_VAR
is the set value 113092
. The value is RESULT_VAR
also given which 75284812356
.
So far this is what I came up with, but I'm not sure if this is the right way or there is a faster and better way.
import random
from hashlib import md5
UNKNOWN = 0
CONST_VAR = 113092
RESULT_VAR = 75284812356
hash_res = 0
while hash_res != RESULT_VAR:
UNKNOWN = UNKNOWN+1
random.seed(UNKNOWN+hash(CONST_VAR))
hash_res = random.randint(1<<32, 1<<40)
print UNKNOWN
, UNKNOWN
, hash_res
RESULT_VAR
. UNKNOWN
, (a.k.a. hash_res
RESULT_VAR
)
, , ?
#, - :)