diff --git a/src/hash.ml b/src/hash.ml index 5c91cdc5..0fbdd01a 100644 --- a/src/hash.ml +++ b/src/hash.ml @@ -6,17 +6,19 @@ (* C-terminated strings some strings need to be hashed with a '\0' termination char *) -module Hash_32 = struct - type t = Digestif.SHA256.t +open Digestif - let hash s = Digestif.SHA256.(digest_string s) +module Hash_32 = struct + type t = SHA256.t + + let hash s = SHA256.(digest_string s) let of_octets s = match String.length s = 32 with | false -> Fmt.failwith "Hash.of_octets failure: data is not 32 bytes" - | true -> Digestif.SHA256.of_raw_string s + | true -> SHA256.of_raw_string s - let to_octets = Digestif.SHA256.to_raw_string + let to_octets = SHA256.to_raw_string let of_b32 s = Result.map of_octets (B32.decode s) let bin = @@ -37,17 +39,17 @@ module Hash_32 = struct end module Hash_64 = struct - type t = Digestif.SHA512.t + type t = SHA512.t - let hash s = Digestif.SHA512.(digest_string s) + let hash s = SHA512.(digest_string s) let of_octets s = match String.length s = 64 with | false -> Fmt.failwith "Hash.of_octets failure: data is not 64 bytes" - | true -> Digestif.SHA512.of_raw_string s + | true -> SHA512.of_raw_string s let to_octets v = - let s = Digestif.SHA512.to_raw_string v in + let s = SHA512.to_raw_string v in match String.length s = 64 with | false -> Fmt.failwith "Hash.to_octets failure: data is not 64 bytes" | true -> s @@ -77,7 +79,7 @@ module Hash_32_cstr = struct let hash s = let s = s ^ "\x00" in - Digestif.SHA256.(digest_string s) + SHA256.(digest_string s) end module Hash_64_cstr = struct @@ -85,7 +87,7 @@ module Hash_64_cstr = struct let hash s = let s = s ^ "\x00" in - Digestif.SHA512.(digest_string s) + SHA512.(digest_string s) end module type Hash_S = sig