Crypt-NULL
view release on metacpan or search on metacpan
$ciphertext = $cipher->encrypt($plaintext);
$plaintext = $cipher->decrypt($ciphertext);
=head1 DESCRIPTION
The NULL Encryption Algorithm is a symmetric block cipher described in
RFC 2410 by Rob Glenn and Stephen Kent.
This module implements NULL encryption. It supports the Crypt::CBC
interface, with the following functions.
=head2 Functions
=over
=item blocksize
Returns the size (in bytes) of the block (16, in this case).
=item decrypt($data)
Decrypts blocksize() bytes of $data and returns the corresponding
plaintext.
=back
=head1 SEE ALSO
Crypt::CBC, Crypt::TEA, Crypt::Twofish
=head1 AUTHOR
Abhijit Menon-Sen <ams@wiw.org>
Copyright 2001 Abhijit Menon-Sen. All rights reserved.
This software is distributed under the terms of the Artistic License
<URL:http://ams.wiw.org/code/artistic.txt>.
$null = Crypt::NULL->new($key);
$ciphertext = $null->encrypt($plaintext);
$plaintext = $null->decrypt($ciphertext);
DESCRIPTION
The NULL Encryption Algorithm is a symmetric block cipher described
in RFC 2410 by Rob Glenn and Stephen Kent.
This module implements NULL encryption. It supports the Crypt::CBC
interface, with the following functions.
Functions
blocksize
Returns the size (in bytes) of the block (16, in this case).
keysize
Returns the size (in bytes) of the key (16, in this case).
encrypt($data)
Encrypts blocksize() bytes of $data and returns the
corresponding ciphertext.
decrypt($data)
Decrypts blocksize() bytes of $data and returns the
corresponding plaintext.
SEE ALSO
Crypt::CBC, Crypt::TEA, Crypt::Blowfish
AUTHOR
Abhijit Menon-Sen <ams@wiw.org>
Copyright 2001 Abhijit Menon-Sen. All rights reserved.
This software is distributed under the terms of the Artistic License
<URL:http://ams.wiw.org/code/artistic.txt>.
END { print "not ok 1\n" unless $loaded }
my $key = pack "H*", '1234567890ABCDEFFEDCBA0987654321';
my $plaintext = "Network Security People Have A Strange Sense Of Humor";
use Crypt::NULL;
ok($loaded = 1);
ok($null = Crypt::NULL->new("abcdefghijklmnop"));
ok("aaaabbbb", $null->decrypt($null->encrypt("aaaabbbb")));
eval 'use Crypt::CBC';
if ($@) { print "skipping Crypt::CBC test\n"; }
else {
print "trying CBC... ";
my $c = Crypt::CBC->new($key, "NULL") || 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 0.845 second using v1.01-cache-2.11-cpan-df04353d9ac )