README 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. perfect_hash.py
  2. Ilan Schnell <ilanschnell@gmail.com>, 2008
  3. Generate a minimal perfect hash function for the keys in a file,
  4. desired hash values may be specified within this file as well.
  5. A given code template is filled with parameters, such that the
  6. output is code which implements the hash function.
  7. Templates can easily be constructed for any programming language.
  8. The code is based on an a program A.M. Kuchling wrote:
  9. http://www.amk.ca/python/code/perfect-hash
  10. The algorithm the program uses is described in the paper
  11. 'Optimal algorithms for minimal perfect hashing',
  12. Z. J. Czech, G. Havas and B.S. Majewski.
  13. http://citeseer.ist.psu.edu/122364.html
  14. Content:
  15. perfect_hash.py The actual program, try $ ./perfect_hash.py animals.txt
  16. doc HTML and plain text documentation
  17. example1-C An example which shows how to generate a C program
  18. which implements a perfect hash table.
  19. example2-C Another example in C.
  20. example-C++ In this C++ example, a class is used to define the
  21. interface to a static lookup table.
  22. example-PyModule A lookup table in implemented as a C extension module
  23. for Python.
  24. example-Python Some small Python programs which show how to access
  25. some functions and classes in perfect_hash.py directly,
  26. i.e. using perfect_hash has a Python module, rather
  27. than a standalone program.
  28. graph A small program `py2dot' which converts the default python
  29. output code from perfect_hash.py into a .dot-file which
  30. can be used by Graphviz (see http://www.graphviz.org/) to
  31. create a picture of the graph.
  32. run Runs some tests.