Skip to content

Commit

Permalink
added signature test, test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
InfiniteSwerve committed Dec 15, 2022
1 parent db2a8b1 commit b4a41eb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
20 changes: 20 additions & 0 deletions deku-p/src/core/crypto/tests/alg_intf_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ struct

let to_sign =
List.map (fun string -> Deku_crypto.BLAKE2b.hash string) to_hash

let signatures =
List.map
(fun sk ->
List.map (fun hash -> (Signature.sign sk hash, hash)) to_sign)
secret_keys
end

module Test_secret_key_data = struct
Expand Down Expand Up @@ -125,5 +131,19 @@ struct
Alcotest.(check' string)
~msg:"presigned hashes are equal" ~expected:Tezos_data.to_sign
~actual:to_sign

let signatures () =
let signatures =
let out =
List.map
(fun sig_list ->
List.map (fun (sg, _) -> helper_string_signatures sg) sig_list)
Signature_data.signatures
in
String.concat "" (List.flatten out)
in
Alcotest.(check' string)
~msg:"signatures are equal" ~expected:Tezos_data.signatures
~actual:signatures
end
end
6 changes: 5 additions & 1 deletion deku-p/src/core/crypto/tests/test_ed25519.ml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,9 @@ let run () =
test_case "compare" `Quick Test_key_hash_data.compare;
test_case "equality" `Quick Test_key_hash_data.equality;
] );
("Signatures", [ test_case "to_sign" `Quick Test_signature_data.to_sign ]);
( "Signatures",
[
test_case "to sign" `Quick Test_signature_data.to_sign;
test_case "signatures" `Quick Test_signature_data.signatures;
] );
]

0 comments on commit b4a41eb

Please sign in to comment.