This commit is contained in:
swrup 2026-02-28 01:27:25 +01:00
parent 867ef1f47b
commit f7cb91615d
3 changed files with 44 additions and 21 deletions

View file

@ -272,23 +272,9 @@ 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 pub_len = String.length pub in
let b = Bytes.create (4 + 4 + pub_len) in
Bytes.set_int32_be b 0 age_mask;
Bytes.set_int32_be b 4 cipher;
Bytes.blit_string pub 0 b (4 + 4) pub_len;
SHA512.(digest_bytes b)
let s = RsaPublicKey.to_octets pub in
SHA512.digest_string s
let of_octets s =
match SHA512.of_raw_string_opt s with