Gather up another utility.
[u/mdw/catacomb] / utils / ecentry-prettify.pl
CommitLineData
38b90111 1#! /usr/bin/perl
2
3sub 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
17my %CTYPE = ("niceprime" => "primeproj",
18 "prime" => "primeproj",
19 "binpoly" => "binproj",
20 "binnorm" => "binproj");
21
22my $name = shift;
23my $kind = shift;
24
25my $p = gather("p");
26my $a = gather("a");
27my $b = gather("b");
28my $r = gather("r");
29my $h = gather("h");
30my $g = gather("g");
31
32print "curve $name $kind\n";
33$p = "0x".$p if $kind =~ /bin/;
34system "./ecptd", "$kind $p $CTYPE{$kind} 0x$a 0x$b", "0x$r", $h, $g;