This commit is contained in:
parent
da29f5bae3
commit
77559b9c3d
2 changed files with 4 additions and 17 deletions
|
|
@ -272,23 +272,8 @@ end = struct
|
||||||
|
|
||||||
type t = SHA512.t
|
type t = SHA512.t
|
||||||
|
|
||||||
(* = GNUNET_CRYPTO_BSA_(RSA|CS) *)
|
|
||||||
type cipher =
|
|
||||||
| RSA
|
|
||||||
| CS [@ocaml.warning "-37"]
|
|
||||||
|
|
||||||
let cipher_to_int32 = function RSA -> 1_l | CS -> 2_l
|
|
||||||
|
|
||||||
let hash_of_rsa pub =
|
let hash_of_rsa pub =
|
||||||
let age_mask = 0_l in
|
let s = RsaPublicKey.to_octets pub in
|
||||||
let cipher = cipher_to_int32 RSA in
|
|
||||||
let pub = RsaPublicKey.to_octets pub in
|
|
||||||
let len = String.length pub in
|
|
||||||
let b = Bytes.create (4 + 4 + len) in
|
|
||||||
Bytes.set_int32_be b 0 age_mask;
|
|
||||||
Bytes.set_int32_be b 4 cipher;
|
|
||||||
Bytes.blit_string pub 0 b 8 len;
|
|
||||||
let s = Bytes.to_string b in
|
|
||||||
SHA512.digest_string s
|
SHA512.digest_string s
|
||||||
|
|
||||||
let of_octets s =
|
let of_octets s =
|
||||||
|
|
|
||||||
|
|
@ -149,7 +149,9 @@ let () =
|
||||||
(DenominationHash.hash_of_rsa
|
(DenominationHash.hash_of_rsa
|
||||||
(Result.get_ok @@ RsaPublicKey.of_b32 rsa_pub))
|
(Result.get_ok @@ RsaPublicKey.of_b32 rsa_pub))
|
||||||
in
|
in
|
||||||
Fmt.pr "--@."; Fmt.pr "@.%s@." h_pub; Fmt.pr "@.%s@." h_pub'
|
assert (h_pub' = h_pub);
|
||||||
|
|
||||||
|
()
|
||||||
in
|
in
|
||||||
|
|
||||||
f test1; f test2
|
f test1; f test2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue