package xxhash

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type hash = nativeint
type state

Short input

val hash : ?seed:hash -> string -> hash

hash ~seed input returns the hash of input. This is equivalent to

let state = create () in
reset ~seed state;
update state input;
let hash = digest state in
free state;
hash

Streaming

val create : unit -> state

create () returns an uninitialized state.

val reset : ?seed:hash -> state -> unit

reset ~seed state resets state with an optional seed.

val update : state -> string -> unit

update state input adds input to state.

val digest : state -> hash

digest state returns the hash all input added to state.

val free : state -> unit

free state releases the memory used by state.

val with_state : ?seed:hash -> (state -> unit) -> hash

with_state ~seed f returns the hash of all input added to state by f.

with_state (fun state -> update state input) is equivalent to hash input.

OCaml

Innovation. Community. Security.