perfect_hash.py
./perfect_hash.py -h
Usage: ./perfect_hash.py [options] KEYS_FILE [TMPL_FILE]
Generates code for perfect hash functions from a file with keywords and a code
template. If no template file is provided, a small built-in Python template is
processed and the output code is written to stdout.
Options:
--version show program's version number and exit
-h, --help show this help message and exit
--delimiter=STR Delimiter for list items used in output, the default
delimiter is ', '
--indent=INT Make INT spaces at the beginning of a new line when
generated list is wrapped. Default is 4
--width=INT Maximal width of generated list when wrapped. Default
width is 76
--comment=STR STR is the character, or sequence of characters, which
marks the beginning of a comment (which runs till the
end of the line), in the input KEYS_FILE. Default is
'#'
--splitby=STR STR is the character by which the columns in the input
KEYS_FILE are split. Default is ','
--keycol=INT Specifies the column INT in the input KEYS_FILE which
contains the keys. Default is 1, i.e. the first
column.
--trials=INT Specifies the number of trials before NG is increased.
A small INT will give compute faster, but the array G
will be large. A large INT will take longer to
compute but G will be smaller. Default is 5
--hft=INT Hash function type INT. Possible values are 1
(StrSaltHash) and 2 (IntSaltHash). The default is 1
-e, --execute Execute the generated code within the Python
interpreter.
-o FILE, --output=FILE
Specify output FILE explicitly. `-o std' means
standard output. `-o no' means no output. By default,
the file name is obtained from the name of the
template file by substituting `tmpl' to `code'.
-v, --verbose verbosity