Slight reorganization. Add elliptic curves from X9.62.
[u/mdw/catacomb] / utils / ecentry-prettify.pl
diff --git a/utils/ecentry-prettify.pl b/utils/ecentry-prettify.pl
new file mode 100644 (file)
index 0000000..3b72053
--- /dev/null
@@ -0,0 +1,34 @@
+#! /usr/bin/perl
+
+sub gather {
+  my ($what) = @_;
+  print "$what?\n";
+  my $x = "";
+  while (<>) {
+    chomp;
+    last if $_ eq ".";
+    $x .= $_;
+  }
+  $x =~ s/\s+//g;
+  $x =~ s/[.,]//g;
+  return lc($x);
+}
+
+my %CTYPE = ("niceprime" => "primeproj",
+            "prime" => "primeproj",
+            "binpoly" => "binproj",
+            "binnorm" => "binproj");
+
+my $name = shift;
+my $kind = shift;
+
+my $p = gather("p");
+my $a = gather("a");
+my $b = gather("b");
+my $r = gather("r");
+my $h = gather("h");
+my $g = gather("g");
+
+print "curve $name $kind\n";
+$p = "0x".$p if $kind =~ /bin/;
+system "./ecptd", "$kind $p $CTYPE{$kind} 0x$a 0x$b", "0x$r", $h, $g;