ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Crypt-Ed25519/t/02_native.t
Revision: 1.1
Committed: Fri Mar 27 20:23:13 2015 UTC (11 years, 5 months ago) by root
Content type: application/x-troff
Branch: MAIN
CVS Tags: rel-0_1
Log Message:
*** empty log message ***

File Contents

# Content
1 BEGIN { $| = 1; print "1..1025\n"; }
2
3 use Crypt::Ed25519;
4
5 print "ok 1\n";
6
7 my $i = 1;
8
9 for (0..511) {
10 my ($pub, $priv) = Crypt::Ed25519::generate_keypair;
11 my $m = Crypt::Ed25519::eddsa_secret_key;
12
13 $m = substr "$m$m", 0, rand 64;
14
15 my $s = Crypt::Ed25519::sign $m, $pub, $priv;
16
17 my $valid = Crypt::Ed25519::verify $m, $pub, $s;
18 print $valid ? "" : "not ", "ok ", ++$i, "\n";
19
20 my $valid = !Crypt::Ed25519::verify "x$m", $pub, $s;
21 print $valid ? "" : "not ", "ok ", ++$i, "\n";
22 }
23