This commit is contained in:
swrup 2026-02-05 17:54:39 +01:00
parent 98e5937981
commit 04aa64f424

View file

@ -8,7 +8,7 @@
open Digestif open Digestif
module Hash_32 = struct module H32 = struct
type t = SHA256.t type t = SHA256.t
let hash s = SHA256.(digest_string s) let hash s = SHA256.(digest_string s)
@ -38,7 +38,7 @@ module Hash_32 = struct
Jsont.of_of_string ~kind:"Hash 32" of_b32 ~enc Jsont.of_of_string ~kind:"Hash 32" of_b32 ~enc
end end
module Hash_64 = struct module H64 = struct
type t = SHA512.t type t = SHA512.t
let hash s = SHA512.(digest_string s) let hash s = SHA512.(digest_string s)
@ -74,16 +74,16 @@ module Hash_64 = struct
end end
(* Hash over string + '\0' *) (* Hash over string + '\0' *)
module Hash_32_cstr = struct module H32_cstr = struct
include Hash_32 include H32
let hash s = let hash s =
let s = s ^ "\x00" in let s = s ^ "\x00" in
SHA256.(digest_string s) SHA256.(digest_string s)
end end
module Hash_64_cstr = struct module H64_cstr = struct
include Hash_64 include H64
let hash s = let hash s =
let s = s ^ "\x00" in let s = s ^ "\x00" in
@ -102,14 +102,14 @@ module type Hash_S = sig
val of_b32 : B32.t -> (t, string) result val of_b32 : B32.t -> (t, string) result
end end
module FullPaytoHash : Hash_S = Hash_32 module FullPaytoHash : Hash_S = H32
module NormalizedPaytoHash : Hash_S = Hash_32 module NormalizedPaytoHash : Hash_S = H32
module DenominationHash : Hash_S = Hash_64 module DenominationHash : Hash_S = H64
module PrivateContractHash : Hash_S = Hash_64 module PrivateContractHash : Hash_S = H64
module ExtensionsPolicyHash : Hash_S = Hash_64 module ExtensionsPolicyHash : Hash_S = H64
module MerchantWireHash : Hash_S = Hash_64 module MerchantWireHash : Hash_S = H64
module AgeCommitmentHash : Hash_S = Hash_64 module AgeCommitmentHash : Hash_S = H64
module BlindedCoinHash : Hash_S = Hash_64 module BlindedCoinHash : Hash_S = H64
module CoinPubHash : Hash_S = Hash_64 module CoinPubHash : Hash_S = H64
module OutputCommitmentHash : Hash_S = Hash_64 module OutputCommitmentHash : Hash_S = H64
module HashPlanchetsP : Hash_S = Hash_64 module HashPlanchetsP : Hash_S = H64