From 77559b9c3dd016d66c8c8e69f4098b2e9893d8f2 Mon Sep 17 00:00:00 2001 From: swrup Date: Sat, 28 Feb 2026 02:46:44 +0100 Subject: [PATCH] --- src/crypto.ml | 17 +---------------- test/test_crypto.ml | 4 +++- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/crypto.ml b/src/crypto.ml index 733b6bce..fc3772d5 100644 --- a/src/crypto.ml +++ b/src/crypto.ml @@ -272,23 +272,8 @@ end = struct 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 age_mask = 0_l 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 + let s = RsaPublicKey.to_octets pub in SHA512.digest_string s let of_octets s = diff --git a/test/test_crypto.ml b/test/test_crypto.ml index fba6e4ce..52944cb6 100644 --- a/test/test_crypto.ml +++ b/test/test_crypto.ml @@ -149,7 +149,9 @@ let () = (DenominationHash.hash_of_rsa (Result.get_ok @@ RsaPublicKey.of_b32 rsa_pub)) in - Fmt.pr "--@."; Fmt.pr "@.%s@." h_pub; Fmt.pr "@.%s@." h_pub' + assert (h_pub' = h_pub); + + () in f test1; f test2