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


PAB3 documentation  | view source Contained in the PAB3 distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  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

Top

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

Top

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

Top

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

AUTHORS

Top

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

Christian Mueller <christian_at_hbr1.com>

COPYRIGHT

Top


PAB3 documentation  | view source Contained in the PAB3 distribution.