On 6/20/07, yitzle <[EMAIL PROTECTED]> wrote:
What function/module (I prefer built in functions...) is there that I
can use to do some simple/basic reversable (opposed to crypt()'s one
way) encryption?
I want to be able to encrypt/decrypt a textfile.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/



Without more information about why you want to encrypt something we
can give no good advice; so here's some bad advice

#!/usr/bin/perl

use strict;
use warnings;

my $plaintext = do { local $/ = undef; <> };
my $pad = "X" x length $plaintext;

my $encryptedtext = $plaintext      ^ $pad;
my $decryptedtext = $encryptedtext  ^ $pad;
print "plaintext:\n$plaintext\n\nencryptedtext:\n$encryptedtext\n\n",
       "decryptedtext:\n$decryptedtext\n";

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to