total = 10

print("RANDOM:")
import random

for n in range(total):
    rest = random.randint(0,10**10-1)
    code = "{n:06}{rest:010}".format(n=n, rest=rest)
    formatted = code[0:4] + "-" + code[4:8] + "-" + code[8:12] + "-" + code[12:]
    print(formatted)


print("TESTABLE:")

import hashlib

SALT = "some_salt"

def generate(n):
    _bytes = (str(n) + SALT).encode("ascii")
    _hash = hashlib.md5(_bytes).hexdigest()
    rest = int(_hash, base=16) % (10**10)
    code = "{n:06}{rest:010}".format(n=n, rest=rest)
    formatted = code[0:4] + "-" + code[4:8] + "-" + code[8:12] + "-" + code[12:]
    return formatted

def test(code):
    raw_code = code.replace("-","")
    n = int(raw_code[0:6])
    return code == generate(n)
        
for n in range(total):
    code = generate(n)
    print(code, test(code))