| 1 | #! /usr/bin/perl |
| 2 | |
| 3 | sub gather { |
| 4 | my ($what) = @_; |
| 5 | print "$what?\n"; |
| 6 | my $x = ""; |
| 7 | while (<>) { |
| 8 | chomp; |
| 9 | last if $_ eq "."; |
| 10 | $x .= $_; |
| 11 | } |
| 12 | $x =~ s/\s+//g; |
| 13 | $x =~ s/[.,]//g; |
| 14 | return lc($x); |
| 15 | } |
| 16 | |
| 17 | my %CTYPE = ("niceprime" => "primeproj", |
| 18 | "prime" => "primeproj", |
| 19 | "binpoly" => "binproj", |
| 20 | "binnorm" => "binproj"); |
| 21 | |
| 22 | my $name = shift; |
| 23 | my $kind = shift; |
| 24 | |
| 25 | my $p = gather("p"); |
| 26 | my $a = gather("a"); |
| 27 | my $b = gather("b"); |
| 28 | my $r = gather("r"); |
| 29 | my $h = gather("h"); |
| 30 | my $g = gather("g"); |
| 31 | |
| 32 | print "curve $name $kind\n"; |
| 33 | $p = "0x".$p if $kind =~ /bin/; |
| 34 | system "./ecptd", "$kind $p $CTYPE{$kind} 0x$a 0x$b", "0x$r", $h, $g; |