This commit is contained in:
swrup 2026-02-16 17:55:21 +01:00 committed by Swrup
parent 0b6f5e3db5
commit 53debfd866
11 changed files with 40 additions and 165 deletions

View file

@ -1,4 +1,3 @@
(* TODO use SHA512.of_raw_string_opt *)
open Digestif
module type S = sig
@ -20,7 +19,7 @@ module H32 = struct
let of_octets s =
match SHA256.of_raw_string_opt s with
| None -> Fmt.failwith "H32.of_octets failure: data is not 32 bytes"
| None -> Fmt.failwith "H32.of_octets failure"
| Some t -> t
let to_octets = SHA256.to_raw_string
@ -50,7 +49,7 @@ module H64 = struct
let of_octets s =
match SHA512.of_raw_string_opt s with
| None -> Fmt.failwith "H64.of_octets failure: data is not 64 bytes"
| None -> Fmt.failwith "H64.of_octets failure"
| Some t -> t
let to_octets = SHA512.to_raw_string