Mdc::EZcrypt version 2.009 -- 12Mar2004
A string encryption module
use Mdc::EZcrypt;
$EZ = new Mdc::EZcrypt( key => 'mypassword' );
$ciphertext = $EZ->encipher($plain_text);
$plain_text = $EZ->decipher($ciphertext);
An eazy to use symmetric encryption module that uses a very simple yet powerfull algorithm. The encrypted string returned by the encipher method will be encoded using MIME::Base64 by default. The output will be binary if the ``base64'' parameter is cleared or set to zero.
The EZcrypt algorithm compresses the plain text then generates two secure hash strings. The first hash string is created using the SHA1 fingerprint of the supplied key, salt string and a checksum of the compressed data. This hash string is expanded to equal the length of the compressed data.
The second hash string is created using the SHA1 fingerprint of the supplied key and salt string. This hash string is expanded to equal the length of the compressed data plus one.
The compressed data is XOR'ed with the first hash string. A checksum character is appended to the resulting ciphertext. Finally, the ciphertext and checksum character are XOR'ed with the second hash string.
Using a checksum character in this fassion, will gaurantee that the resulting encrypted data will be unique even if only one character in the plain text changes.
The secure hash function (SHA-1) is easily replaced with any another secure hash function
Create a new string encryption object.
$c = new Mdc::EZcrypt( key => 'mypassword',
salt => '123XYZ',
Base64 => 1,
eol => "\n" );
key => 'mypassword'
salt => '123XYZ'
Base64 => 1 # set output data encoding to MIME Base64 (default)
Base64 => 0 # disable Base64 encoding
eol => "\n" # set end of line character to new line (default)
eol => "" # set end of line character to empty string
Encipher a plain text string.
$c_text = $c->encipher($plain_text);
Decipher a ciphertext string.
$plain_text = $c->decipher($c_text);
This module was developed by Mark K Mueller who is always open to comments and suggestions.
Email: mailto:mkmueller@cpan.org or visit http://www.markmueller.com/
EZcrypt Copyright (c) 2003, Mark K Mueller
Mueller Design and Consulting
PO Box 576705, Modesto, CA 95357
All Rights Reserved.
This module is free software. It may be used, and redistributed under
the same terms as Perl itself.
Compress::Zlib, MIME::Base64, Digest::SHA1