Skip to content

Instantly share code, notes, and snippets.

@av1d
Created August 1, 2021 05:31
Show Gist options
  • Save av1d/332820f535b960bfb0c426dd0c39e5ab to your computer and use it in GitHub Desktop.
Save av1d/332820f535b960bfb0c426dd0c39e5ab to your computer and use it in GitHub Desktop.
Generate a random alphanumeric hash, 8 characters in length
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