- SEE ALSO
- COPYRIGHT AND LICENSE
Crypt::TEA_XS - Implementation of the Tiny Encryption Algorithm
use Crypt::TEA_XS; use Crypt::CBC; my $tea = Crypt::TEA_XS->new( $key ); my $cbc = Crypt::CBC->new( -cipher => $tea ); my $text = 'The quick brown fox jumps over the lazy dog.'; my $cipher_text = $cbc->encrypt( $text ); my $plain_text = $cbc->decrypt( $cipher_text );
TEA is a 64-bit symmetric block cipher with a 128-bit key and a variable number of rounds (32 is recommended). It has a low setup time, and depends on a large number of rounds for security, rather than a complex algorithm. It was developed by David J. Wheeler and Roger M. Needham, and is described at http://www.ftp.cl.cam.ac.uk/ftp/papers/djw-rmn/djw-rmn-tea.html
This module implements TEA encryption. It supports the Crypt::CBC interface, with the following functions.
Returns the maximum TEA key size, 16 bytes.
Returns the TEA block size, which is 8 bytes. This function exists so that Crypt::TEA_XS can work with Crypt::CBC.
my $tea = Crypt::TEA_XS->new( $key, $rounds );
This creates a new Crypt::TEA_XS object with the specified key. The optional rounds parameter specifies the number of rounds of encryption to perform, and defaults to 32.
$cipher_text = $tea->encrypt($plain_text);
Encrypts blocksize() bytes of $plain_text and returns the corresponding ciphertext.
$plain_text = $tea->decrypt($cipher_text);
Decrypts blocksize() bytes of $cipher_text and returns the corresponding plaintext.
Kars Wang <firstname.lastname@example.org>
This software is copyright (c) 2015 by Kars Wang.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.