Created
July 27, 2020 00:05
-
-
Save vivithemage/cabfd715742b99eafbcb624e4d1152ce to your computer and use it in GitHub Desktop.
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 hashlib | |
import sys | |
def md5Experiment(domain_name, total_shards): | |
hash_obj = hashlib.md5(domain_name) | |
digest = hash_obj.hexdigest() | |
shard_id = int(digest, 16) % total_shards | |
return shard_id | |
argument = str.encode(sys.argv[1]) | |
print(str(md5Experiment(argument, 64))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment