[libmath-prime-util-perl] 03/29: Fix filename of ecpp verification, add sage version

Partha P. Mukherjee ppm-guest at moszumanska.debian.org
Thu May 21 18:48:15 UTC 2015


This is an automated email from the git hooks/post-receive script.

ppm-guest pushed a commit to annotated tag v0.27
in repository libmath-prime-util-perl.

commit f191905baaa3a900e4b26a4236c98c018241d5af
Author: Dana Jacobsen <dana at acm.org>
Date:   Mon Apr 22 15:28:14 2013 -0700

    Fix filename of ecpp verification, add sage version
---
 MANIFEST                                           |  3 +-
 ...fy-gmp-eccp-cert.pl => verify-gmp-ecpp-cert.pl} |  0
 examples/verify-sage-ecpp-cert.pl                  | 63 ++++++++++++++++++++++
 3 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/MANIFEST b/MANIFEST
index f0044b0..cc171c6 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -58,7 +58,8 @@ examples/test-bpsw.pl
 examples/test-factor-gnufactor.pl
 examples/test-primes-script.pl
 examples/test-primes-script2.pl
-examples/verify-gmp-eccp-cert.pl
+examples/verify-gmp-ecpp-cert.pl
+examples/verify-sage-ecpp-cert.pl
 bin/primes.pl
 bin/factor.pl
 t/01-load.t
diff --git a/examples/verify-gmp-eccp-cert.pl b/examples/verify-gmp-ecpp-cert.pl
similarity index 100%
rename from examples/verify-gmp-eccp-cert.pl
rename to examples/verify-gmp-ecpp-cert.pl
diff --git a/examples/verify-sage-ecpp-cert.pl b/examples/verify-sage-ecpp-cert.pl
new file mode 100755
index 0000000..f6ad0fd
--- /dev/null
+++ b/examples/verify-sage-ecpp-cert.pl
@@ -0,0 +1,63 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use Math::BigInt try=>"GMP,Pari";
+use Math::Prime::Util qw/:all/;
+use Data::Dump qw/dump/;
+
+# Takes the output of one of the Sage functions:
+#     goldwasser_kilian(n)
+#     atkin_morain(n)
+#     ecpp(n)
+# and run it through MPU's verifier.
+#
+# Example:
+#   perl verify-sage-ecpp-cert.pl <<EOP
+#   [100000000000000000039, 0, 100000000000000000038, 99999999982060129348, 964019216509,
+#   (19568017359532265472 : 20079688430965599468 : 1), 964019216509, 0, 858481324253L, 964020818668, 241005204667,
+#   (799886189130 : 601302851255 : 1), 241005204667, 0, 11167880189, 241006096857, 626011,
+#   (140197349256 : 38879868868 : 1)]
+#   EOP
+
+my @input;
+while (<>) {
+  chomp;
+  push @input, split(/\s*,\s*/, $_);
+}
+my $N;
+my ($n, $a, $b, $m, $q, $Px, $Py);
+my @cert;
+while (@input) {
+  $_ = shift @input;
+  $_ =~ s/L\s*$//;
+  if (!defined $N) {
+    die "Need brackets around certificate\n" unless s/^\s*\[//;
+    $N = $_;
+    $n = $_;
+    @cert = ($N, "AGKM");
+  }
+  elsif (!defined $n) { $n = $_; }
+  elsif (!defined $a) { $a = $_; }
+  elsif (!defined $b) { $b = $_; }
+  elsif (!defined $m) { $m = $_; }
+  elsif (!defined $q) { $q = $_; }
+  elsif (!defined $Px) {
+    die "Can't parse point" unless /\(\s*(\d+)\s*:\s*(\d+)\s*:\s*(\d+)\s*\)/;
+    $Px = $1;
+    $Py = $2;
+    die "Bad input\n"
+        unless defined $n && defined $a && defined $b && defined $m
+            && defined $q && defined $Px && defined $Py;
+    push @cert, [$n, $a, $b, $m, $q, [$Px,$Py]];
+    undef $n;
+    undef $a;
+    undef $b;
+    undef $m;
+    undef $q;
+    undef $Px;
+    undef $Py;
+  }
+}
+
+print dump(\@cert), "\n";
+print verify_prime(@cert) ? "SUCCESS\n" : "FAILURE\n";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmath-prime-util-perl.git



More information about the Pkg-perl-cvs-commits mailing list