Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import hashlib
- import random
- import string
- sha1_value = {}
- find = False
- k = 12
- while find is False:
- value = ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(32))
- hash_object = hashlib.sha1(value.encode())
- hex_dig = hash_object.hexdigest()
- if sha1_value.get(hex_dig[len(hex_dig)-k:], 0) != 0:
- print("collisione\nValore 1")
- print(sha1_value[hex_dig[len(hex_dig)-k:]] + "-->" + hex_dig[len(hex_dig)-k:] )
- print("valore2\n" + value + "-->"+ hex_dig[len(hex_dig)-k:])
- find = True
- sha1_value[hex_dig[len(hex_dig)-k:]] = value
- print(len(sha1_value))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement