Attention ! Cet interpréteur n’est pas totalement compatible avec Python3.
import hashlib
sha1vide = hashlib.sha1(b"").hexdigest()
def sha1(i):
return hashlib.sha1(bytes(i)).hexdigest()
for i in range(256)
print()
print("vide", hashlib.sha1(b"").hexdigest())
print("x00", hashlib.sha1(b"\x00").hexdigest())
print("x00", hashlib.sha1(bytes.fromhex('0')).hexdigest())
# reste foireux
print("A ", hashlib.sha1(b"A").hexdigest())
print("x41", hashlib.sha1(b"\x41").hexdigest())
print("0 ", hashlib.sha1(b"0").hexdigest())
print("x30", hashlib.sha1(b"\x30").hexdigest())
print("bin(0)", hashlib.sha1(bin(0)).hexdigest())
print("0 b0", hashlib.sha1('0b0').hexdigest())
# pas de int print(hashlib.sha1(int("0", 2)).hexdigest())
print(hashlib.sha1(b"accent").hexdigest())