package nanoid

  1. Overview
  2. Docs
Nano ID implementation for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

1.0.0.tar.gz
md5=a5c602bbac85b60218297f4705726ed9
sha512=debb9c4c0fb1ccadb4814cda797e96d380b20120e258b3b193635e65215a6fe74ab932fca40ab27d6502f72797326b44329952336bab2e745feb963d03e82419

doc/src/nanoid.nanoid_os/versions.ml.html

Source file versions.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
module Intf = struct
  (** Random bytes generator *)
  module type RNG = sig
    (** [random_bytes size] returns a buffer and a offset at which [size] fresh
        random bytes are readable. *)
    val random_bytes : int -> bytes * int
  end

  (** Nano ID generator *)
  module type S = sig
    (** [nanoid ?size ()] generates a random Nano ID of size [size], which
        defaults to 21. *)
    val nanoid : ?size:int -> unit -> string
  end
end

module type VERSION_1_0 = sig
  (** @inline *)
  include module type of Intf

  (** [pseudo_seeded seed] is a [RNG] module that generates pseudo random
      numbers based on the given [seed]. It is subject to the same limitations
      as {!Cryptokit.Random.pseudo_rng} *)
  val pseudo_seeded : string -> (module RNG)

  (** [Make (Rng)] is a Nano ID generator based on random number generator [Rng] *)
  module Make (Rng : RNG) : S

  (** [Simple ()] is a Nano ID generator based on the {!pseudo_seeded} random
      number generator seeded with the current system time as given by
      {!Unix.gettimeofday}. *)
  module Simple () : S
end
OCaml

Innovation. Community. Security.