Skip to content

Instantly share code, notes, and snippets.

@lukeaus
Created July 25, 2017 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeaus/52e7f6a2708f221975419989122a6951 to your computer and use it in GitHub Desktop.
Save lukeaus/52e7f6a2708f221975419989122a6951 to your computer and use it in GitHub Desktop.
Convert id to hash
import hashids
SALT = "this is my salt"
hash_func = hashids.Hashids(salt=SALT, min_length=16)
hash_ = hash_func.encode(1,) # ''JEDngB0NV05ev1Ww'
ids = hash_func.decode(hash_) # (1,)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment