NAME

PAB3::Crypt::XOR - Simple periodic XOR encryption

SYNOPSIS

use PAB3::Crypt::XOR qw(:default);

my $key = 'MYSECRETKEY';

$crypt = xor_encrypt( $key, 'plain text' );
print "encrypted: ", unpack( 'H*', $crypt ), "\n";

$plain = xor_decrypt( $key, $crypt );
print "plain: $plain\n";

$crypt = xor_encrypt_hex( $key, 'plain text' );
print "encrypted: $crypt\n";

$plain = xor_decrypt_hex( $key, $crypt );
print "plain: $plain\n";

DESCRIPTION

PAB3::Crypt::XOR provides an interace to simple periodic XOR encryption.

Code is based on BrowseX XOR Encryption.

The BrowseX XOR encryption varies by generating a start seed based upon the XORing of all characters in the password. Modulo arithmetic is used with the seed to determine the offset within the password to start. Modulo is again used to determine when to recalculate the seed based upon the currently selected password character. And finally, the password character itself is XORed with the current seed before it is itself used to XOR the data.

METHODS

encrypt ( $key, $plain )

Encrypt plain data with a key. encrypt() works like decrypt() .

decrypt ( $key, $cipher )

Decrypt cipher to plain data. decrypt() works like encrypt() .

encrypt_hex ( $key, $plain )

Encrypt plain data with a key and return a hexadecimal string of cipher as human readable.

decrypt_hex ( $key, $hex_cipher )

Decrypt hexadecimal string of cipher to plain data.

EXPORTS

By default nothing is exported. To export functions use the export tag ":default". Exported functions get the prefix "xor_".

AUTHORS

BrowseX XOR Encryption http://browsex.com/XOR.html

Christian Mueller <christian_at_hbr1.com>

COPYRIGHT

The PAB3::Crypt::XOR module is free software. You may distribute under the terms of either the GNU General Public License or the Artistic License, as specified in the Perl README file.