The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Crypt::TEA_PP - Pure Perl Implementation of the Tiny Encryption Algorithm

VERSION

version 0.0102

SYNOPSIS

   use Crypt::TEA_PP;
   use Crypt::CBC;

   my $tea = Crypt::TEA_PP->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 );

DESCRIPTION

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.

METHODS

keysize

Returns the maximum TEA key size, 16 bytes.

blocksize

Returns the TEA block size, which is 8 bytes. This function exists so that Crypt::TEA_PP can work with Crypt::CBC.

new

    my $tea =  Crypt::TEA_PP->new( $key, $rounds );
This creates a new Crypt::TEA_PP object with the specified key.
The optional rounds parameter specifies the number of rounds of encryption to perform, and defaults to 32.

encrypt

    $cipher_text = $tea->encrypt($plain_text);
Encrypts blocksize() bytes of $data and returns the corresponding ciphertext.

decrypt

    $plain_text = $tea->decrypt($cipher_text);
Decrypts blocksize() bytes of $data and returns the corresponding plaintext.

SEE ALSO

http://www.vader.brad.ac.uk/tea/tea.shtml

Crypt::CBC

AUTHOR

Kars Wang <jahiy@cpan.org>

COPYRIGHT AND LICENSE

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.