add hash.ml + refacto

This commit is contained in:
swrup 2026-02-05 17:51:24 +01:00 committed by Swrup
parent 44ddee9dab
commit 34f98b697f
11 changed files with 193 additions and 199 deletions

View file

@ -1,4 +1,5 @@
open Syntax
open Hash
let read_file fname = Bos.OS.File.read (Fpath.v fname) |> unwrap_err_msg
@ -60,7 +61,7 @@ let sign ~master_key ~input ~output =
let revoke_denom ~output ~master_key ~h_denom =
let* key = read_master_key_file master_key in
let* h_denom_pub = Bin_type.DenominationHash.of_b32 h_denom in
let* h_denom_pub = DenominationHash.of_b32 h_denom in
let denom_revoke =
let master_sig =
let open Bin_sig.MasterDenominationKeyRevocation in
@ -145,7 +146,7 @@ let enable_auditor ~output ~master_key ~auditor_url ~auditor_name ~auditor_pub
{
start_date= validity_start;
auditor_pub;
h_auditor_url= Bin_type.Hash_64_cstr.hash auditor_url;
h_auditor_url= Hash.Cstring.H64.hash auditor_url;
}
in
let v =
@ -176,7 +177,7 @@ let wire_fee ~output ~master_key ~wire_method ~fee_start ~fee_end ~closing_fee
let open Bin_sig.MasterWireFee in
sign_f ~f:(EddsaSignature.sign ~key)
{
h_wire_method= Bin_type.Hash_64_cstr.hash wire_method;
h_wire_method= Hash.Cstring.H64.hash wire_method;
start_date= fee_start;
end_date= fee_end;
closing_fee;
@ -209,8 +210,8 @@ let drain ~output ~master_key ~debit_account_section ~credit_payto_uri ~wtid
wtid;
date;
amount;
h_section= Bin_type.Hash_64_cstr.hash debit_account_section;
h_payto= Bin_type.FullPaytoHash.hash credit_payto_uri;
h_section= Hash.Cstring.H64.hash debit_account_section;
h_payto= FullPaytoHash.hash credit_payto_uri;
}
in
let v =