Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/One-time-pad/Perl/one-time-pad.pl
Normal file
17
Task/One-time-pad/Perl/one-time-pad.pl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# 20200814 added Perl programming solution
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Crypt::OTP;
|
||||
use Bytes::Random::Secure qw( random_bytes );
|
||||
|
||||
print "Message : ", my $message = "show me the monKey", "\n";
|
||||
|
||||
my $otp = random_bytes(length $message);
|
||||
print "Ord(OTP) : ", ( map { ord($_).' ' } (split //, $otp) ) , "\n";
|
||||
|
||||
my $cipher = OTP( $otp, $message, 1 );
|
||||
print "Ord(Cipher) : ", ( map { ord($_).' ' } (split //, $cipher) ) , "\n";
|
||||
|
||||
print "Decoded : ", OTP( $otp, $cipher, 1 ), "\n";
|
||||
Loading…
Add table
Add a link
Reference in a new issue