import secrets
def chunk(s):
result = ''
for i, char in enumerate(s):
if i % 4 == 0 and i % len(s) != 0:
result += '-'
result += char
return result
print(chunk(secrets.token_hex(8)))
To embed this program on your website, copy the following code and paste it into your website's HTML: