Added testing mechanism to RSA.pl
authorHarvie <tomas@mudrunka.cz>
Thu, 4 Nov 2010 22:34:55 +0000 (23:34 +0100)
committerHarvie <tomas@mudrunka.cz>
Thu, 4 Nov 2010 22:34:55 +0000 (23:34 +0100)
perl/rsa.pl

index c442c6eae2e659fea8f4cd480139546bdc18f9f8..522be22e1a79895d44acff37f5e8074e08e316a7 100755 (executable)
@@ -44,4 +44,6 @@ my $msg=1337;
 my $enc=rsa($msg,$n,$e); #encrypt
        print "ENC: $enc\n";
 my $dec=rsa($enc,$n,$d); #decrypt
-       print "DEC: $dec\nTST: ".$msg.($msg==$dec?"=":"!=").$dec."\n";
+       $test=($msg==$dec);
+       print "DEC: $dec\nTST: ".$msg.($test?"=":"!=").$dec."\n";
+       exit !$test;
This page took 0.135883 seconds and 4 git commands to generate.