mpu-check.pl 432 B

1234567891011121314151617181920
  1. #!/usr/bin/perl
  2. # Trivial command-line client for the function
  3. # Math::Prime::Util::verify_prime, which checks a certificate of
  4. # primality in MPU format.
  5. use strict;
  6. use warnings;
  7. use Math::Prime::Util;
  8. Math::Prime::Util::prime_set_config(verbose => 1);
  9. my $cert = "";
  10. $cert .= $_ while <<>>;
  11. my $success = Math::Prime::Util::verify_prime($cert);
  12. die "verification failed\n" unless $success;
  13. warn "verification succeeded\n";