package colibri2

  1. Overview
  2. Docs
type statistics = {
  1. num_bindings : int;
  2. num_buckets : int;
  3. max_bucket_length : int;
  4. bucket_histogram : int array;
}
val randomize : unit -> unit

After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: Hashtbl.create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

It is recommended that applications or Web frameworks that need to prtect themselves against the denial-of-service attack described in Hashtbl.create call Hashtbl.randomize() at initialization time.

Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of Hashtbl.create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

  • since 4.00.0
module type Hashtbl = sig ... end
module Hashtbl : Hashtbl
OCaml

Innovation. Community. Security.