safe-password
Mis à jour
Mis à jour
import requests
from hashlib import sha1
with open('leaked.txt') as f:
while True:
password = f.readline().strip()
if not password:
break
h = sha1(password.encode()).hexdigest().upper()
r = h[:5]
pwn_list = [line.split(':', 1) for line in requests.get(f"https://api.pwnedpasswords.com/range/{r}").text.splitlines()]
for pwn in pwn_list:
if pwn[0] == h[5:]:
print(password, pwn[1])
# Bubblegum123! 82
# Butterfly123@ 3
# Coconut123@ 8