Mdc::CryptLite


Mdc::CryptLite


        Mdc::CryptLite  version 1.002 -- 05Dec2003
        A simple string encryption module (quick and dirty)


Synopsis

        use Mdc::CryptLite;
        $C = new Mdc::CryptLite 'mypassword';
        $C->encipher( \$text );
        $C->decipher( \$text );
        undef $C;


Description

An easy to use symmetric encryption module that uses a very simple yet powerful algorithm. The encrypted string returned by the encipher method will be binary. The size of the plain text and cipher-text are limited by the amount of available memory. Uses the module Digest::MD5.


Algorithm

The Mdc::CryptLite algorithm compresses the plain text then generates two secure hash strings. The first hash string is created using the MD5 fingerprint of the supplied key, 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 MD5 fingerprint of the supplied key only. This hash string is expanded to equal the length of the data plus one.

The data is XOR'ed with the first hash string. A checksum character is appended to the resulting cipher-text. Finally, the cipher-text and checksum character are XOR'ed with the second hash string.

Using a checksum character in this fashion, will guarantee that the resulting encrypted data will be unique even if only one character in the plain text changes.

The secure hash function (MD5) is easily replaced with any another secure hash function that will produce a larger secure hash.

The encryption is only as strong as the original password. Using one that is not easily guessed helps, but given enough time, any length password will eventually be found.


Methods

new

Create a new string encryption object.

        $C = new Mdc::CryptLite 'mypassword';

encipher

Encipher a plain text string.

        $C->encipher( \$text );

decipher

Decipher a cipher-text string.

        $C->decipher( \$text );


Author and Copyright

 Mdc::CryptLite Copyright (c) 2003 Mark K Mueller. All rights reserved.


 http://www.markmueller.com/

MkM 10:26 PM 2003-09-08