Skip to content

Ocaml bindings for C Minimal Perfect Hashing Library (CMPH)

License

Notifications You must be signed in to change notification settings

jfeser/ocaml-cmph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ocaml-cmph

Ocaml bindings for C Minimal Perfect Hashing Library (CMPH)

Online documentation

Usage

open Printf
open Cmph

let () =
  let keys = [
    "aaaaaaaaaa"; "bbbbbbbbbb"; "cccccccccc"; "dddddddddd"; "eeeeeeeeee"; 
    "ffffffffff"; "gggggggggg"; "hhhhhhhhhh"; "iiiiiiiiii"; "jjjjjjjjjj"
  ] in
  let keyset = KeySet.of_list keys in
  let config = Config.create keyset in
  let hash = Hash.create config in
  List.iter (fun k -> eprintf "key:%s -- hash:%d\n" k (Hash.hash hash k)) keys

Outputs:

key:aaaaaaaaaa -- hash:0
key:bbbbbbbbbb -- hash:1
key:cccccccccc -- hash:2
key:dddddddddd -- hash:3
key:eeeeeeeeee -- hash:4
key:ffffffffff -- hash:5
key:gggggggggg -- hash:6
key:hhhhhhhhhh -- hash:7
key:iiiiiiiiii -- hash:8
key:jjjjjjjjjj -- hash:9

About

Ocaml bindings for C Minimal Perfect Hashing Library (CMPH)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published