Created
January 20, 2014 19:23
-
-
Save kylelk/8527280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os import urandom | |
from hashlib import sha1 | |
import time | |
def mint(name, bits): | |
t = time.strftime("%y%m%d") | |
out = " " | |
count = 0 | |
while out[:bits] != bits*"0": | |
RandomData = urandom(8).encode("base64").replace("\n", "") | |
data = "1:%d:%s:%s::%s:%s"%(bits, t, name, RandomData, format(count, 'x')) | |
out = (''.join(format(ord(x), '08b') for x in sha1(data).digest())) | |
count += 1 | |
return data | |
print mint("email_address", 16) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment