1 | BEGIN { $| = 1; print "1..1081\n"; } |
1 | BEGIN { $| = 1; print "1..1621\n"; } |
2 | |
2 | |
3 | use Crypt::Ed25519; |
3 | use Crypt::Ed25519; |
4 | |
4 | |
5 | # test vectors generated from ed25519's website sign.input via extract-sign.input |
5 | # test vectors generated from ed25519's website sign.input via extract-sign.input |
6 | |
6 | |
… | |
… | |
19 | my ($seed, $pub, $s, $m) = splice @tv, -4, 4; |
19 | my ($seed, $pub, $s, $m) = splice @tv, -4, 4; |
20 | |
20 | |
21 | my $pub_ = Crypt::Ed25519::eddsa_public_key $seed; |
21 | my $pub_ = Crypt::Ed25519::eddsa_public_key $seed; |
22 | print $pub_ eq $pub ? "" : "not ", "ok ", ++$i, "\n"; |
22 | print $pub_ eq $pub ? "" : "not ", "ok ", ++$i, "\n"; |
23 | |
23 | |
|
|
24 | my ($pub__, $priv) = Crypt::Ed25519::generate_keypair $seed; |
|
|
25 | print $pub_ eq $pub__ ? "" : "not ", "ok ", ++$i, "\n"; |
|
|
26 | |
24 | my $s_ = Crypt::Ed25519::eddsa_sign $m, $pub, $seed; |
27 | my $s_ = Crypt::Ed25519::eddsa_sign $m, $pub, $seed; |
|
|
28 | print $s eq $s_ ? "" : "not ", "ok ", ++$i, "\n"; |
|
|
29 | |
|
|
30 | my $s__ = Crypt::Ed25519::sign $m, $pub, $priv; |
25 | print $s eq $s_ ? "" : "not ", "ok ", ++$i, "\n"; |
31 | print $s eq $s_ ? "" : "not ", "ok ", ++$i, "\n"; |
26 | |
32 | |
27 | my $valid = Crypt::Ed25519::eddsa_verify $m, $pub, $s; |
33 | my $valid = Crypt::Ed25519::eddsa_verify $m, $pub, $s; |
28 | print $valid ? "" : "not ", "ok ", ++$i, "\n"; |
34 | print $valid ? "" : "not ", "ok ", ++$i, "\n"; |
29 | |
35 | |