perl enc.pl Create a password: secretpw Enter your message to be encrypted: This is an encryption test Your encrypted message: c7cda0cc55bde684b5db9698d5d6d7b0c9a9bde2d274e1dba6db #### perl denc.pl Enter your password: secretpw Enter your encrypted message: c7cda0cc55bde684b5db9698d5d6d7b0c9a9bde2d274e1dba6db Your decrypted message: This is an encryption test #### use warnings; use strict; use 5.10.0; print "\nCreate a password: "; chomp ( my $password = ); my $salt = 'j4'; my $crypt_pass = crypt( $salt, $password ); print "Enter your message to be encrypted: "; chomp ( my $message = ); my @hex_pass = map { sprintf( "%x", ( ord( $_ ))) } split //, $crypt_pass; my @hex_msg = map { sprintf( "%x", ( ord( $_ ))) } split //, $message; my @crypted; my @hash; push @hash, @hex_pass until @hash > @hex_msg; my $i=0; for my $letter ( @hex_msg ){ push @crypted, hex( $letter ) + hex( $hash[$i] ); $i++; } @crypted = map { sprintf( "%x", $_ ) } @crypted; print "\nYour encrypted message: "; print @crypted; print "\n\n"; #### use warnings; use strict; use 5.10.0; print "\nEnter your password: "; chomp ( my $password = ); my $salt = 'j4'; my $crypt_pass = crypt( $salt, $password ); my @hex_pass = map { sprintf( "%x", ( ord( $_ ) ) ) } split //, $crypt_pass; print "Enter your encrypted message: "; chomp ( my $message = ); my @crypt_message = ( $message =~ m/../g ); my @hash; push @hash, @hex_pass until @hash > @crypt_message; my @decrypted_message; my $n = 0; for my $letter ( @crypt_message ){ push @decrypted_message, ( hex( $letter ) - hex( $hash[$n] ) ) ; $n++; } print "\nYour decrypted message: "; print map { chr( $_ ) } @decrypted_message; print "\n\n";