Math::XOR 0.02 review

Download
by rbytes.net on

Math::XOR is a package to handle XOR encryption of string buffers. SYNOPSIS use XOR; print xor_buf("hello", "w

License: Perl Artistic License
File size: 1K
Developer: Tyler MacDonald
0 stars award from rbytes.net

Math::XOR is a package to handle XOR encryption of string buffers.

SYNOPSIS

use XOR;
print xor_buf("hello", "world"), "n";

The XOR module allows you to quickly XOR two strings together. This is the only method of encryption that (assuming the randomness of the pattern used as an encryption key) truly cannot be broken. It also has interesting, very direct mathematical properties which can be fun to play with:

XOR string 1 and string 2, you get string 3 XOR string 1 and string 3, you get string 2 XOR string 2 and string 3, you get string 1

FUNCTIONS

xor_buf($string1, $string2)

This function will return a scalar, which is the result of XORing the two strings passed to it together. The strings may contain binary data.

If $string2 is not at least as many characters long as $string1, xor_buf() will print an error and return undef. Only as many characters as there are in $string1 will be returned; excess characters in $string2 will be ignored. For this reason, when encrypting data it is good to think of $string1 as your "data" and $string2 as your "key".

Requirements:
Perl

Math::XOR 0.02 search tags