💾 Archived View for gmi.noulin.net › gitRepositories › perfecthash › file › README.md.gmi captured on 2023-01-29 at 10:50:02. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
README.md (1005B)
1 # Sheepy 2 This is a sheepy package for [sheepy](https://spartatek.se/r/sheepy/file/README.md.html) and using [libsheepy](https://spartatek.se/r/libsheepy/file/README.md.html) 3 4 # perfecthash 5 6 [What is a perfect hash function?](https://en.wikipedia.org/wiki/Perfect_hash_function) 7 8 `genHanov` generates a perfect hash function C source code given a list of keys in a text file. 9 `genHanov` expects one key per line. 10 11 genHanov is inspired by the Steve Hanov implementation of the Dr Daoud perfect hash algorithm. 12 13 # Usage 14 15 Install with spm: `spm -g install perfecthash` 16 17 Generate a perfect hash function: 18 19 ``` 20 genHanov keys.txt 21 ``` 22 23 The generated code depends on the crc package, to install it: 24 `spm install crc` 25 26 Just running `genHanov` prints the help. 27 28 To configure `genHanov`, create a `hanovConfig.yml` file with this content: 29 30 ```yml 31 --- 32 type: hanovt 33 perfectHashData: perfectHash 34 keysArray: keys 35 funcScope: static inline 36 hashFunc: hanovHash 37 lookupFunc: hanovLookup 38 findFunc: hanovFind 39 ```