Created
April 12, 2021 06:43
-
-
Save martijnberger/d73d7384847cd036246615259737c30a to your computer and use it in GitHub Desktop.
Generate mongoDB-ish hash
This file contains hidden or 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 os | |
import time | |
import binascii | |
def generate(): | |
timestamp = "{:x}".format(int(time.time())) | |
rest = binascii.b2a_hex(os.urandom(8)).decode("ascii") | |
return timestamp + rest | |
generate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment