uhuh.
This commit is contained in:
parent
867ef1f47b
commit
f7cb91615d
3 changed files with 44 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue