From ecdf2356b7be385b56c237a07738ce1b895d2756 Mon Sep 17 00:00:00 2001 From: Harvie Date: Thu, 4 Nov 2010 23:34:55 +0100 Subject: [PATCH] Added testing mechanism to RSA.pl --- perl/rsa.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/perl/rsa.pl b/perl/rsa.pl index c442c6e..522be22 100755 --- a/perl/rsa.pl +++ b/perl/rsa.pl @@ -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; -- 2.30.2