Crypt-XXTEA

 view release on metacpan or  search on metacpan

XXTEA.pm  view on Meta::CPAN


Crypt::XXTEA - XXTEA encryption arithmetic module.

=head1 SYNOPSIS

    use Crypt::XXTEA;

=head1 DESCRIPTION

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. 

=head1 FUNCTIONS

=over 4

=item xxtea_encrypt

    my $ciphertext = xxtea_encrypt($plaintext, $key);

This function encrypts $plaintext using $key and returns the $ciphertext.

=item encrypt

    my $ciphertext = Crypt::XXTEA::encrypt($plaintext, $key);
   
This function is the same as xxtea_encrypt.

=item xxtea_decrypt

    my $plaintext = xxtea_decrypt($ciphertext, $key);

This function decrypts $ciphertext using $key and returns the $plaintext.

=item decrypt

    my $plaintext = Crypt::XXTEA::decrypt($ciphertext, $key);

This function is the same as xxtea_decrypt.

=back

=head1 EXAMPLE

    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;

=head1 NOTES

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.

=head1 SEE ALSO

Crypt::DES
Crypt::Blowfish
Crypt::IDEA

=head1 COPYRIGHT

The implementation of the XXTEA algorithm was developed by,
and is copyright of, Ma Bingyao (andot@ujn.edu.cn).

=cut



( run in 2.078 seconds using v1.01-cache-2.11-cpan-e1769b4cff6 )