Crypt::XXTEA - XXTEA encryption arithmetic module.
use Crypt::XXTEA;
XXTEA is a secure and fast encryption algorithm. It's suitable for web development. This module allows you to encrypt or decrypt a string using the algorithm.
my $ciphertext = xxtea_encrypt($plaintext, $key);
This function encrypts $plaintext using $key and returns the $ciphertext.
my $ciphertext = Crypt::XXTEA::encrypt($plaintext, $key);
This function is the same as xxtea_encrypt.
my $plaintext = xxtea_decrypt($ciphertext, $key);
This function decrypts $ciphertext using $key and returns the $plaintext.
my $plaintext = Crypt::XXTEA::decrypt($ciphertext, $key);
This function is the same as xxtea_decrypt.
use Crypt::XXTEA; my $ciphertext = xxtea_encrypt("Hello XXTEA.", "1234567890abcdef"); my $plaintext = xxtea_decrypt($ciphertext, "1234567890abcdef"); print $plaintext; $ciphertext = Crypt::XXTEA::encrypt("Hi XXTEA.", "1234567890abcdef"); $plaintext = Crypt::XXTEA::decrypt($ciphertext, "1234567890abcdef"); print $plaintext;
If $plaintext is equal to "", it returns "".
It returns 0 when fails to decrypt.
Only the first 16 bytes of $key is used. if $key is shorter than 16 bytes, it will be padding \0.
The XXTEA algorithm is stronger and faster than Crypt::DES, Crypt::Blowfish & Crypt::IDEA.
Crypt::DES Crypt::Blowfish Crypt::IDEA
The implementation of the XXTEA algorithm was developed by, and is copyright of, Ma Bingyao (andot@ujn.edu.cn).
To install Crypt::XXTEA, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::XXTEA
CPAN shell
perl -MCPAN -e shell install Crypt::XXTEA
For more information on module installation, please visit the detailed CPAN module installation guide.