Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, I need some help with file encryption in Perl. I want to know how to encrypt a file and replace the enciphered file with the original (plain text) version. Thanks.

Replies are listed 'Best First'.
Re: File Encryption
by duckyd (Hermit) on Dec 15, 2008 at 17:37 UTC
    By "replace the enciphered file with the original" I assume you mean decrypt? There are many modules in the Crypt:: namespace on CPAN, one of which should be suitable for your needs. The perldoc for Crypt::Blowfish provides a very straightforward example of encrypting and decrypting:
    use Crypt::Blowfish; my $cipher = new Crypt::Blowfish $key; my $ciphertext = $cipher->encrypt($plaintext); my $plaintext = $cipher->decrypt($ciphertext);
      Many thanks...
Re: File Encryption
by Joost (Canon) on Dec 15, 2008 at 19:22 UTC
Re: File Encryption
by kennethk (Abbot) on Dec 15, 2008 at 17:24 UTC
    Umm, do you mean "encrypt a file and replace the original (plain text) file with the enciphered version" or do you want to encrypt and then decrypt the file?