Crypt-TEA

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    $plaintext = $cipher->decrypt($ciphertext);

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
    https://web-beta.archive.org/web/20131226114205/http://www.ftp.cl.cam.ac.uk:80/ftp/papers/djw-rmn/djw-rmn-tea.html

    This module implements TEA encryption. It supports the Crypt::CBC
    interface, with the following functions.

  Functions

    blocksize
        Returns the size (in bytes) of the block (8, in this case).

    keysize
        Returns the size (in bytes) of the key (16, in this case).

README  view on Meta::CPAN

        Encrypts blocksize() bytes of $data and returns the
        corresponding ciphertext.

    decrypt($data)
        Decrypts blocksize() bytes of $data and returns the
        corresponding plaintext.

SEE ALSO
    https://web-beta.archive.org/web/20030208020932/http://www.vader.brad.ac.uk/tea/tea.shtml

    Crypt::CBC, Crypt::Blowfish, Crypt::DES

ACKNOWLEDGEMENTS
    Dave Paris
        For taking the time to discuss and review the initial
        version of this module, making several useful suggestions,
        and contributing tests.

    Mike Blazer and Gil Cohen
        For testing under Windows.

TEA.pm  view on Meta::CPAN


=head1 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
L<https://web-beta.archive.org/web/20131226114205/http://www.ftp.cl.cam.ac.uk:80/ftp/papers/djw-rmn/djw-rmn-tea.html>

This module implements TEA encryption. It supports the Crypt::CBC
interface, with the following functions.

=head2 Functions

=over

=item blocksize

Returns the size (in bytes) of the block (8, in this case).

TEA.pm  view on Meta::CPAN


Decrypts blocksize() bytes of $data and returns the corresponding
plaintext.

=back

=head1 SEE ALSO

L<https://web-beta.archive.org/web/20030208020932/http://www.vader.brad.ac.uk/tea/tea.shtml>

Crypt::CBC, Crypt::Blowfish, Crypt::DES

=head1 ACKNOWLEDGEMENTS

=over 4

=item Dave Paris

For taking the time to discuss and review the initial version of this
module, making several useful suggestions, and contributing tests.

test.pl  view on Meta::CPAN

END   { print "not ok 1\n" unless $loaded }

my $key       = pack "H*", '1234567890ABCDEFFEDCBA0987654321';
my $plaintext = "The quick brown fox jumps over the lazy dog.";

use Crypt::TEA;
ok($loaded = 1);
ok(my $tea = Crypt::TEA->new("abcdefghijklmnop"));
ok("aaaabbbb", $tea->decrypt($tea->encrypt("aaaabbbb")));

eval 'use Crypt::CBC';
if ($@) { print "skipping Crypt::CBC test\n"; }
else {
    print "trying CBC... ";
    my $c = Crypt::CBC->new($key, "TEA") || die "$!\n";
    my $t = $c->encrypt_hex($plaintext);
    ok($plaintext, $c->decrypt_hex($t));
}

print "\nBenchmarks\n";
{
    my $s = Benchmark->new;

    for (my $i = 0; $i < 20000; $i++) {
        my $in  = pack "H*", "0123456789ABCDEF";



( run in 1.162 second using v1.01-cache-2.11-cpan-e1769b4cff6 )