Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Shows given key name and set count, what is the set index used.
#!/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
You can’t perform that action at this time.