This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,6 @@
(library
(name md5_lib)
(public_name base.md5)
(preprocess no_preprocessing)
(libraries)
(js_of_ocaml (javascript_files)))

View file

@ -0,0 +1,21 @@
type t = string
(* Share the digest of the empty string *)
let empty = Digest.string ""
let make s = if s = empty then empty else s
let compare = compare
let length = 16
let to_binary s = s
let to_binary_local s = s
let of_binary_exn s =
assert (String.length s = length);
make s
;;
let unsafe_of_binary = make
let to_hex = Digest.to_hex
let of_hex_exn s = make (Digest.from_hex s)
let string s = make (Digest.string s)
let bytes s = make (Digest.bytes s)
let subbytes bytes ~pos ~len = make (Digest.subbytes bytes pos len)

View file

@ -0,0 +1,19 @@
type t
val compare : t -> t -> int
(** [length = 16] is the size of the digest in bytes. *)
val length : int
val to_binary : t -> string
val to_binary_local : t -> string
val of_binary_exn : string -> t
(** assumes the input is 16 bytes without checking *)
val unsafe_of_binary : string -> t
val to_hex : t -> string
val of_hex_exn : string -> t
val string : string -> t
val bytes : bytes -> t
val subbytes : bytes -> pos:int -> len:int -> t