X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/c65df27983057ec76ed0e72bb370f9a5ae7dad28..38b901110909d19388502b487f0529514cf853ff:/utils/ecentry-prettify.pl?ds=sidebyside diff --git a/utils/ecentry-prettify.pl b/utils/ecentry-prettify.pl new file mode 100644 index 0000000..3b72053 --- /dev/null +++ b/utils/ecentry-prettify.pl @@ -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;