Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
16 changes: 16 additions & 0 deletions deku-p/src/core/crypto/tests/data_for_tests/data_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ struct
List.map
(fun string -> Blake2B.hash_bytes string |> Blake2B.to_bytes)
(List.map (fun bytes -> [ bytes ]) byte_data)

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

module Print_secret_key = struct
Expand Down Expand Up @@ -179,5 +184,16 @@ struct
|> String.map (fun char -> (Char.code char |> Int.to_string).[0])
in
Format.printf "let to_sign = \"%s\"\n%!" to_sign

let print_signatures () =
Format.printf "let signatures = \n%!";
let out =
List.map
(fun sig_list ->
List.map (fun (sg, _) -> helper_print_signatures sg) sig_list)
Sig.signatures
in
let out = String.concat "" (List.flatten out) in
Format.printf "\"%s\"\n%!" out
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;
] );
]
4 changes: 4 additions & 0 deletions deku-p/src/core/crypto/tests/tezos_test_data.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module type Tezos_data = sig
val compared_key_hashes : string list
val equality_key_hashes : bool
val to_sign : string
val signatures : string
end

module Ed25519_data : Tezos_data = struct
Expand Down Expand Up @@ -54,4 +55,7 @@ module Ed25519_data : Tezos_data = struct

let to_sign =
"1221111113822211222227921529112243121122121222115441211112211232817511621326112702119221122192222173718731151233283141117142231111154312111111323622251114129212"

let signatures =
"98861551781511471792211708425961981552825099239559816678128121481549710490782281396175642011981452095979796143672204018613812419516587141207437982067622143241821777712926157148839411012214524023752682431251373832181751062278641301801840131171138627219015815541422462269520789181581692912918819842202141251416919624199311382203115623398961577916468219938020216517710816417219213917825395160163168442472391899014188149142101931016912863190116122209250192137917189169612181441409313332168681467840361031862041012312342967238181591582018816366209102232105694642322161171071102452019111691236912777217155991952538716621119896101174136220185196831261118190194214219818013081233222801413320111118411617224175182697921413520019617124319212224281575910110314298902061291292362082351062261611109622029451142202472498122112815951427590883010013115725211423817976255811022091765012919610016891122042513815525158910032319416918956610710103335639118438821793233701104114424823420815102814914856233601515820874581184105552151521192442219614412412135190397439179140982422115421630239220901132079916410160207904019181432431432382516220814834927121682817315014241223719785128588810343112160381372122222217019948531652061531920659172108146394816158120411922523311218877793214622214023524716223723112224191832282332211244118871531528858245103240195228146493712116349187211100391251601822206185215109147197111203176392446211820746119211802061465523418018651124952022181038512225321247108683982099117189167222331842521313212095144117181661332451758462121252132181263415321022381209015196154491568518813348222016710840741682502172392115321317418380721936201168931919156160185206220153176122199932151291024412281037440151245337313318818069925113915212951160158179173231782272326790123141142104245197114166171120382228425271175249462715813211723752183126190142146148571363218771211183188851815317816208107238171134131205632124120215291191461323616415467232521412512664139131522291061702116140811121701752267764410311641882301382081069964522973023564211195207148967151174216244402241622225113721163122271031791912249975680128247139414214813200116314086128132243394126113323524148171201224162128232332511320636117182188942526391240641701225520319627915193176140147135183236150161151622621120479501045824991243121112946157136240171251241168145253012022791072231963121311011202328321013924589210214832191922532201342152042409513816020010439199118120322814020311520312209229155214211794556622611023619623237163202165210167195112025420270145177601410455152100204982202025018985195451024720916413551227233221127212227138415130471601087018580897313485391081191031691771406248755413517719868942512392481441632319412010666151141106451551101241942249971174175182242212251649245136305224924457148320716512414112166188161625221892212149915414522168887921780331515391801911521911219858574111245149107861746591742541419422224244415216424499021716758962293975100786914493323713631223314613522411262076116815941832122214523671204679722817759687394018212521319013722691103941731769311419167622009140772462381421262497391841267322822213015123221144491022122919410019716923989120217911214812514487145118581942072421741323451146174246128761246114875891581642161011071413434130728825176524890227649772130344184170194259195135722231511571081016523217016011415614536142205291252112179419117592179238794439321199174213118183162551131822824150195314621814857633512423317412914513115371842462239815519422361345011710119782411842221652094461591537924719694207124142130507620524385361427881651845818213710558631931712152532231296712921222758411514035951359566184188250177419055154819854184104155771115021132232201747521918496156141132146251236230233118549924212223787296128194682361891118415716952772338060528315411214215471082222729123871735036826813621811319581522823924522014218815718322611124147618451202231202222241125131214241501291192181951141832152991781842408712243185100325054462385319220321216818217463862437910446240293773146245792081272161462501741981051672254994951322815425492042089206198118145125421051115144933717911"
end