#!/usr/bin/perl # -u option performs the conversion in reverse if (@ARGV && $ARGV[0] ne "-u") { print "\nInvalid option.\n"; die "usage: lamencrypt.pl [option] (-u decrypts)\n"; } print "\nEnter string to translate: "; chomp(my $input_string = <STDIN>); my @user_input = split //, $input_string; my $element = 0; my $output_string; foreach $user_input (@user_input){ my $value = ord($user_input[$element]); my $uncounter = $element; while ($uncounter >= 0) { if (@ARGV && $ARGV[0] =~ /-u/){ $value--; $uncounter--; } else { $value++; $uncounter--; } } $element++; $output_string .= chr($value); } while (length($output_string) > $element){ chop($output_string); } print "\nLamely encrypted: "; print "$output_string\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Silly "encryption".....just for fun ;)
by merlyn (Sage) on Jul 29, 2002 at 13:37 UTC | |
by Guitarded (Novice) on Jul 29, 2002 at 20:22 UTC | |
by merlyn (Sage) on Jul 29, 2002 at 21:27 UTC | |
by runrig (Abbot) on Jul 29, 2002 at 21:59 UTC | |
|
Re: Silly "encryption".....just for fun ;)
by Juerd (Abbot) on Jul 29, 2002 at 10:26 UTC | |
|
Re: Silly "encryption".....just for fun ;)
by Anonymous Monk on Jul 30, 2002 at 12:11 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |