This commit is contained in:
parent
98e5937981
commit
04aa64f424
1 changed files with 17 additions and 17 deletions
34
src/hash.ml
34
src/hash.ml
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
open Digestif
|
||||
|
||||
module Hash_32 = struct
|
||||
module H32 = struct
|
||||
type t = SHA256.t
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
module Hash_64 = struct
|
||||
module H64 = struct
|
||||
type t = SHA512.t
|
||||
|
||||
let hash s = SHA512.(digest_string s)
|
||||
|
|
@ -74,16 +74,16 @@ module Hash_64 = struct
|
|||
end
|
||||
|
||||
(* Hash over string + '\0' *)
|
||||
module Hash_32_cstr = struct
|
||||
include Hash_32
|
||||
module H32_cstr = struct
|
||||
include H32
|
||||
|
||||
let hash s =
|
||||
let s = s ^ "\x00" in
|
||||
SHA256.(digest_string s)
|
||||
end
|
||||
|
||||
module Hash_64_cstr = struct
|
||||
include Hash_64
|
||||
module H64_cstr = struct
|
||||
include H64
|
||||
|
||||
let hash s =
|
||||
let s = s ^ "\x00" in
|
||||
|
|
@ -102,14 +102,14 @@ module type Hash_S = sig
|
|||
val of_b32 : B32.t -> (t, string) result
|
||||
end
|
||||
|
||||
module FullPaytoHash : Hash_S = Hash_32
|
||||
module NormalizedPaytoHash : Hash_S = Hash_32
|
||||
module DenominationHash : Hash_S = Hash_64
|
||||
module PrivateContractHash : Hash_S = Hash_64
|
||||
module ExtensionsPolicyHash : Hash_S = Hash_64
|
||||
module MerchantWireHash : Hash_S = Hash_64
|
||||
module AgeCommitmentHash : Hash_S = Hash_64
|
||||
module BlindedCoinHash : Hash_S = Hash_64
|
||||
module CoinPubHash : Hash_S = Hash_64
|
||||
module OutputCommitmentHash : Hash_S = Hash_64
|
||||
module HashPlanchetsP : Hash_S = Hash_64
|
||||
module FullPaytoHash : Hash_S = H32
|
||||
module NormalizedPaytoHash : Hash_S = H32
|
||||
module DenominationHash : Hash_S = H64
|
||||
module PrivateContractHash : Hash_S = H64
|
||||
module ExtensionsPolicyHash : Hash_S = H64
|
||||
module MerchantWireHash : Hash_S = H64
|
||||
module AgeCommitmentHash : Hash_S = H64
|
||||
module BlindedCoinHash : Hash_S = H64
|
||||
module CoinPubHash : Hash_S = H64
|
||||
module OutputCommitmentHash : Hash_S = H64
|
||||
module HashPlanchetsP : Hash_S = H64
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue