This commit is contained in:
swrup 2025-11-21 20:13:51 +01:00
parent 8c0e8b2c6d
commit c741123b3d

View file

@ -142,10 +142,6 @@ module UTIL = struct
hash s hash s
end end
module MK_HASH_64 () = struct
include HHH_64
end
module HHH_32 = struct module HHH_32 = struct
type t = { hash: Digestif.SHA256.t } type t = { hash: Digestif.SHA256.t }
@ -186,11 +182,7 @@ module UTIL = struct
hash s hash s
end end
module MK_HASH_32 () = struct module MK_HASH_64_of_src (M : sig
include HHH_32
end
module MK_SRC_HASH_64 (M : sig
type src type src
val to_octets : src -> string val to_octets : src -> string
@ -205,7 +197,7 @@ module UTIL = struct
let hash src = hash (M.to_octets src) let hash src = hash (M.to_octets src)
end end
module MK_SRC_HASH_32 (M : sig module MK_HASH_32_of_src (M : sig
type src type src
val to_octets : src -> string val to_octets : src -> string
@ -225,7 +217,7 @@ include UTIL
(* -- Cryptographic primitives -- *) (* -- Cryptographic primitives -- *)
module DenominationHash = MK_SRC_HASH_32 (struct module DenominationHash = MK_HASH_32_of_src (struct
type src = Crypto.RsaPublicKey.t type src = Crypto.RsaPublicKey.t
let to_octets = Crypto.RsaPublicKey.to_octets let to_octets = Crypto.RsaPublicKey.to_octets
@ -246,17 +238,17 @@ end
(* Hash over a full payto://-URI, including receiver-name (* Hash over a full payto://-URI, including receiver-name
(and possibly BIC and other optional fields). *) (and possibly BIC and other optional fields). *)
module FullPaytoHash = MK_HASH_32 () module FullPaytoHash = Hash_32
(* Hash over a normalized payto://-URI, including all optional (* Hash over a normalized payto://-URI, including all optional
fields and also with account-part canonicalized (so no BIC). *) fields and also with account-part canonicalized (so no BIC). *)
module NormalizedPaytoHash = MK_HASH_32 () module NormalizedPaytoHash = Hash_32
module PrivateContractHash = MK_HASH_64 () module PrivateContractHash = Hash_64
module ExtensionsPolicyHash = MK_HASH_64 () module ExtensionsPolicyHash = Hash_64
module MerchantWireHash = MK_HASH_64 () module MerchantWireHash = Hash_64
(* TODO missing doc *) (* TODO missing doc *)
module AgeCommitmentHash = MK_HASH_64 () module AgeCommitmentHash = Hash_64
(* Hash over: (* Hash over:
a) the hash of the denomination's public key, a) the hash of the denomination's public key,
@ -264,16 +256,16 @@ module AgeCommitmentHash = MK_HASH_64 ()
c) cipher-dependant blinded information. c) cipher-dependant blinded information.
See implementation of `TALER_CoinEvHash` See implementation of `TALER_CoinEvHash`
in libtalerexchange for details. *) in libtalerexchange for details. *)
module BlindedCoinHash = MK_HASH_64 () module BlindedCoinHash = Hash_64
module CoinPubHash = MK_HASH_64 () module CoinPubHash = Hash_64
module OutputCommitmentHash = MK_HASH_64 () module OutputCommitmentHash = Hash_64
(* This is the running SHA512-hash over all (* This is the running SHA512-hash over all
`TALER_BlindedCoinHashP` values of an array of coins. `TALER_BlindedCoinHashP` values of an array of coins.
Note that each `TALER_BlindedCoinHashP` itself Note that each `TALER_BlindedCoinHashP` itself
captures the hash of the corresponding denomination's captures the hash of the corresponding denomination's
public key. *) public key. *)
module HashPlanchetsP = MK_HASH_64 () module HashPlanchetsP = Hash_64
(* --- Keys --- *) (* --- Keys --- *)