Skip to content

Instantly share code, notes, and snippets.

@akionsight
Created October 17, 2020 05:28
Show Gist options
  • Save akionsight/12243f62c2db024cbc1bee2f8668db1a to your computer and use it in GitHub Desktop.
Save akionsight/12243f62c2db024cbc1bee2f8668db1a to your computer and use it in GitHub Desktop.
secrets.token_hex example
import secrets
print(secrets.token_hex(2))
print(secrets.token_hex(4))
print(secrets.token_hex(8))
print(secrets.token_hex(12))
print(secrets.token_hex(16))
print(secrets.token_hex(12))
print(secrets.token_hex(144))
## returned the following in one random test case
'''
1d45
852aa5d7
2dc7e4729f6d1732
bad3458c391b6669d788c447
7ecfb2e83b34ab33560c8c30d7e202fd
ba45a11cd370166690314841
f04a9d59d0302af9a99788cbdaef7ddb3621fc0ef6130e1716de000f49b3ffa6a81cd1bcd43fec3556e285a32f5396ca4d949b6bb4204c34964462200d4239b32a049b9a61049013d7c243740ede021077fbcd53ec75e94a702a6a2e9b5dac30e9bbe46a0f5e11048677b57c096c452d1aba0fa3e304ac36c31d5f8dffc1975eeb32897fc209e1b5e9564a1866fdfd47
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment