Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use List::AllUtils qw(none first);
- $| = 1;
- my $SUBJECT_NUM = 7;
- my $MOD = 20201227;
- chomp( my @keys = <> );
- print "Public Keys: ", join( ',', @keys ), "\n";
- my $loop = 0;
- my $val = $SUBJECT_NUM;
- while (none { $val == $_ } @keys) {
- $val = ($val * $SUBJECT_NUM) % $MOD;
- $loop++;
- print "Looping... $loop\r" if ($loop % 100000 == 0);
- }
- print "Loop size: $loop (public key $val) \n";
- my $other = first { $_ != $val } @keys;
- print "Other public key: $other\n";
- my $val2 = $other;
- while ($loop--) {
- $val2 = ($val2 * $other) % $MOD;
- print "$loop\t$val2 \r" if ($loop % 100000 == 0);
- }
- print "Encryption key: $val2 \n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement