Created
August 1, 2021 05:31
-
-
Save av1d/332820f535b960bfb0c426dd0c39e5ab to your computer and use it in GitHub Desktop.
Generate a random alphanumeric hash, 8 characters in length
This file contains 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
import random | |
hash1 = random.getrandbits(128) # | |
hash2 = "%032x" % hash1 # format | |
hash3 = hash2[:8] # trim to 8 char | |
print(hash3) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment