| 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 $beta = ($kind eq "binnorm") ? "0x".gather("beta") : ""; |
| 27 | my $a = gather("a"); |
| 28 | my $b = gather("b"); |
| 29 | my $r = gather("r"); |
| 30 | my $h = gather("h"); |
| 31 | my $g = gather("g"); |
| 32 | |
| 33 | print "curve $name $kind\n"; |
| 34 | $p = "0x".$p if $kind =~ /bin/; |
| 35 | my @l = ("./ecptd", "$kind $p $beta $CTYPE{$kind} 0x$a 0x$b", "0x$r", $h, $g); |
| 36 | # print join(" ", @l), "\n"; |
| 37 | system @l; |