hashes = dict()
while True:
    if len(hashes) % 10000 == 0:
        print(len(hashes))
newurl = ''.join(random.choice(string.lowercase) for _ in range(30))
newhash = hash_short(newurl)
if newhash in hashes and newurl != hashes[newhash]:
    print('found a collision!')
print(newhash)
print(newurl)
print(hashes[newhash])
print(len(hashes))
break
hashes[newhash] = newurl
How do I calculate how many hashes I need in order to find a collision?