2024-12-30 12:41:55 +00:00
|
|
|
include Stdlib.Digest
|
|
|
|
|
2025-01-04 09:08:36 +00:00
|
|
|
let error_msgf fmt = Format.kasprintf (fun msg -> Error (`Msg msg)) fmt
|
|
|
|
let pp ppf t = Format.pp_print_string ppf (Stdlib.Digest.to_hex t)
|
2024-12-30 12:41:55 +00:00
|
|
|
|
|
|
|
let of_string str =
|
|
|
|
match of_hex str with
|
|
|
|
| v -> Ok v
|
|
|
|
| exception Invalid_argument _ -> error_msgf "Invalid digest value: %S" str
|
|
|
|
|
|
|
|
let length = String.length (string "")
|
|
|
|
|
|
|
|
module Map = Map.Make (struct
|
|
|
|
type nonrec t = t
|
|
|
|
|
|
|
|
let compare = compare
|
|
|
|
end)
|