Показать сообщение отдельно

  #4  
Старый 30.04.2018, 17:19
Debug
Участник форума
Регистрация: 27.04.2018
Сообщений: 216
С нами: 4234881

Репутация: 0
По умолчанию

Hash Master -- 90

Дан текст:

Miles forgot his login for OPENWI:RE, so he asked Darcy to send a password reset. Instead, she gave him the hash of his password—and the custom hashing algorithm. Miles doesn’t have great password security, so you could probably brute force it… but maybe there’s a way to do this more efficiently?
Here is the hash of Miles’ password: 293366475
Here is the hashing algorithm:
def hash_it(string):
q = 0
z = 127
for i in [int(byte) for byte in bytearray(string, "utf-8")]:
q += i
z *= i
return (((q << 3)+1)*z) % (2**32 - 1)

Я пошел следующим путем и решил просто сбрутить хэш используя следующий алгоритм. Для атаки был взят словарь rockyou.
Сам скрипт следующий:
f = open('rockyou.txt' , 'r')
f_read = f.read().split()
def hash_it(string):
q = 0
z = 127
for i in [int(byte) for byte in bytearray(string, "utf-8")]:
q += i
z *= i
return (((q << 3)+1)*z) % (2**32 - 1)
for i in f_read:
try:
if str(hash_it(i)) == "293366475":
print i
break
except Exception, ex:

После нескольких секунд получаем флаг - aaaaab

 
Ответить с цитированием