Category: | Cryptography |
Author/Contact Info | perlmonk@m-net.arbornet.org |
Description: | A encryption algorithm. That I whipped up. Takes file name as command line argument, -d switch sets it into decrypt mode. Key can be anything but the longer the better.XIMP stands for XIMP Is Mucho Polyalphabetic. DISCLAIMER: This should by no means be taken seriously! It was simply an experiment! This is by no means real crypto and could be cracked by anyone with even limited knowledge of cryptography. |
#!/usr/bin/perl use strict; my @wheel1 = qw( 8 4 6 6 3 3 8 4 ); my @wheel2 = qw( 1 2 4 6 3 8 8 9 5 1 6 1 7 2 8 1 ); print "KEY:"; chomp(my $key = <STDIN>); my @wheel3 = map(ord, split //, $key); my $file = @ARGV[0]; $/ = undef; print "OPENING $file\n"; open(IN, "$file") || die "painful death! (because there is no $file)"; my ($out); my $plaintext = <IN>; close(IN); open(OUT, ">$file"); my @nums = map(ord, split //, $plaintext); foreach (@nums) { print "*"; my $x = @wheel1[0] + @wheel2[0] + @wheel3[0]; if (@ARGV[1] eq "-d") { $out = $_ + $x; } else { $out = $_ - $x; } $out = chr $out; print OUT $out; push @wheel1, shift @wheel1; push @wheel2, shift @wheel2; print "\b"; } |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Ximp
by Zaxo (Archbishop) on Dec 02, 2001 at 12:55 UTC | |
Re: Ximp
by sparkyichi (Deacon) on Dec 02, 2001 at 04:57 UTC |
Back to
Code Catacombs