Last active
March 3, 2020 22:25
-
-
Save harshavardhana/eec320db38b52559b6e893cdb749566b to your computer and use it in GitHub Desktop.
Shows given key name and set count, what is the set index used.
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
#!/usr/bin/env python3 | |
import argparse | |
import binascii, sys | |
parser = argparse.ArgumentParser(description='Set indexer') | |
parser.add_argument('key', metavar='KEY', type=str, help='key name for the hash index') | |
parser.add_argument('setcount', metavar='SET', type=int, help='total set counts') | |
args = parser.parse_args() | |
print("Hash set index: '{0}'".format(binascii.crc32(args.key) % args.setcount)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment