Crypt-DES_PP

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

	on big-endian machines, too.  Thanks to schinder@pobox.com for
	the bug report, thanks to Frank Naumann (fnaumann@freemint.de)
	for giving me access to his big-endian MiNT machine for debugging.

2000-10-11  Guido Flohr  <guido@freemint.de>

	* DES_PP.ppm: Bumped version number to 0.06.

	* test.pl:
	Eval dependencies to other modules in single quotes, not in curly
	braces to avoid the test to fail if Crypt::CBC is not present.

	* t/cbcref.t:
	Don't print a test number for bulk output when Crypt::CBC is not
	present, so that Test::Harness doesn't get confused.

2000-10-11  Guido Flohr  <guido@freemint.de>

	* DES_PP.ppm: Bumped version number to 0.06.

	* test.pl:
	Eval dependencies to other modules in single quotes, not in curly
	braces to avoid the test to fail if Crypt::CBC is not present.

	* t/cbcref.t:
	Don't print a test number for bulk output when Crypt::CBC is not
	present, so that Test::Harness doesn't get confused.

2000-10-08  Guido Flohr  <guido@freemint.de>

	* DES_PP.ppm: Bumped version number to 0.05.

	* MANIFEST: Added lib/Crypt/.cvsignore.

	* lib/Crypt/.cvsignore: Initial revision.

	* lib/Crypt/DES_PP.pod: Moved to DES_PP.ppm in top-level directory.

	* DES_PP.ppm: Moved from lib/Crypt/DES_PP.pod here.

	* test-xs: Initial revision.

	* test.pl: Added benchmarks to run against XS version in CBC mode.

	* Makefile.PL:
	Changed suffix rule to a full rule for building lib/Crypt/DES_PP.pm.

	* MANIFEST:
	Moved lib/Crypt/DES_PP.pod to DES_PP.pm, renamed test-xs.pl to test-xs.

	* test-xs.pl: Renamed to test-xs.

	* lib/Crypt/DES_PP.pod: Bumped version number to 0.03.

DES_PP.m4  view on Meta::CPAN


=head1 DESCRIPTION

The Data Encryption Standard (DES), also known as Data Encryption 
Algorithm  (DEA) is a semi-strong encryption and decryption algorithm.  

The module is 100 % compatible to Crypt::DES but is implemented 
entirely in Perl.  That means that you do not need a C compiler to 
build and install this extension.  

The module implements the Crypt::CBC interface.  You are encouraged
to read the documentation for Crypt::CBC if you intend to use this
module for Cipher Block Chaining.

The minimum (and maximum) key size is 8 bytes.  Shorter keys will
cause an exception, longer keys will get silently truncated.  Data
is encrypted and decrypted in blocks of 8 bytes.

The module implements the Ultra-Fast-Crypt (UFC) algorithm as found
for example in the GNU libc.  On the Perl side a lot has been done
in order to make the module as fast as possible (function inlining,
use integer, ...).

DES_PP.m4  view on Meta::CPAN

License (LGPL) version 2 or - at your choice - any later version,
see the file ``COPYING.LIB''.

The original C implementation of the Ultra-Fast-Crypt algorithm
was written by Michael Glad (glad@daimi.aau.dk) and has been donated to 
the Free Software Foundation, Inc.  It is covered by the GNU library 
license version 2, see the file ``COPYING.LIB''.

=head1 SEE ALSO

Crypt::CBC(3), Crypt::DES(3), perl(1), m4(1).

=cut

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0

README  view on Meta::CPAN


DESCRIPTION
    The Data Encryption Standard (DES), also known as Data
    Encryption Algorithm (DEA) is a semi-strong encryption and
    decryption algorithm.

    The module is 100 % compatible to Crypt::DES but is implemented
    entirely in Perl. That means that you do not need a C compiler
    to build and install this extension.

    The module implements the Crypt::CBC interface. You are
    encouraged to read the documentation for Crypt::CBC if you
    intend to use this module for Cipher Block Chaining.

    The minimum (and maximum) key size is 8 bytes. Shorter keys will
    cause an exception, longer keys will get silently truncated.
    Data is encrypted and decrypted in blocks of 8 bytes.

    The module implements the Ultra-Fast-Crypt (UFC) algorithm as
    found for example in the GNU libc. On the Perl side a lot has
    been done in order to make the module as fast as possible
    (function inlining, use integer, ...).

README  view on Meta::CPAN

    (guido@imperia.net). It is available under the terms of the
    Lesser GNU General Public License (LGPL) version 2 or - at your
    choice - any later version, see the file ``COPYING.LIB''.

    The original C implementation of the Ultra-Fast-Crypt algorithm
    was written by Michael Glad (glad@daimi.aau.dk) and has been
    donated to the Free Software Foundation, Inc. It is covered by
    the GNU library license version 2, see the file ``COPYING.LIB''.

SEE ALSO
    Crypt::CBC(3), Crypt::DES(3), perl(1), m4(1).

lib/Crypt/DES_PP.pm  view on Meta::CPAN


=head1 DESCRIPTION

The Data Encryption Standard (DES), also known as Data Encryption 
Algorithm  (DEA) is a semi-strong encryption and decryption algorithm.  

The module is 100 % compatible to Crypt::DES but is implemented 
entirely in Perl.  That means that you do not need a C compiler to 
build and install this extension.  

The module implements the Crypt::CBC interface.  You are encouraged
to read the documentation for Crypt::CBC if you intend to use this
module for Cipher Block Chaining.

The minimum (and maximum) key size is 8 bytes.  Shorter keys will
cause an exception, longer keys will get silently truncated.  Data
is encrypted and decrypted in blocks of 8 bytes.

The module implements the Ultra-Fast-Crypt (UFC) algorithm as found
for example in the GNU libc.  On the Perl side a lot has been done
in order to make the module as fast as possible (function inlining,
use integer, ...).

lib/Crypt/DES_PP.pm  view on Meta::CPAN

License (LGPL) version 2 or - at your choice - any later version,
see the file ``COPYING.LIB''.

The original C implementation of the Ultra-Fast-Crypt algorithm
was written by Michael Glad (glad@daimi.aau.dk) and has been donated to 
the Free Software Foundation, Inc.  It is covered by the GNU library 
license version 2, see the file ``COPYING.LIB''.

=head1 SEE ALSO

Crypt::CBC(3), Crypt::DES(3), perl(1), m4(1).

=cut

Local Variables:
mode: perl
perl-indent-level: 4
perl-continued-statement-offset: 4
perl-continued-brace-offset: 0
perl-brace-offset: -4
perl-brace-imaginary-offset: 0

t/cbcref.t  view on Meta::CPAN

#! /usr/local/bin/perl -w

use strict;
use IO::File;

eval 'use Crypt::CBC 1.22';

print "1..2\n";
if ($@) {
	print "ok # skipped in absence of Crypt::CBC 1.22 or higher\n"
		x 2;
	exit 0;
} else {
	print "ok 1\n";
}

my $copying;
eval {
	my $fh;
	my $here = $0;

t/cbcref.t  view on Meta::CPAN

	$fh = IO::File->new ("<$here/../COPYING.LIB")
		or die;

	$copying = <$fh>;
	die unless defined $copying;
	$fh->close;

	my $key = 'Not very secret';
	my $cipher;
	
	$cipher = Crypt::CBC->new ($key, 'DES_PP')
		or die;

	my $result = $cipher->decrypt ($cipher->encrypt ($copying))
		or die;

	$result eq $copying or die;
};
print $@ ? "not ok 2\n" : "ok 2\n";

test-xs  view on Meta::CPAN

        $cipher->decrypt($ciphertext);
    }
    my $t9 = new Benchmark;
    my $td4 = timediff($t9,$t8);
    my $ts4 = timestr($td4);
    print "$ts4\nok 346\n";
    }
}

print "\nTesting Cipher Block Chaining..\n";
eval 'use Crypt::CBC';

if(!$@) {
        if($Crypt::CBC::VERSION < 1.22) {
                $@ = "CBC mode requires Crypt::CBC version 1.22 or higher.";
        } else {

                my $cipher = new Crypt::CBC(pack("H*","0123456789ABCDEF"),"DES_PP");
                my $ciphertext = $cipher->encrypt(pack("H*","37363534333231204E6F77206973207468652074696D6520666F722000"));
                my $plaintext  = $cipher->decrypt($ciphertext);

		if($plaintext ne "7654321 Now is the time for \0") { print "not "; }
                print "ok 347 - CBC Mode\n";
        }
} # end no errors

if($@) {
        print "Error (probably harmless):\n$@\n";
}

print "\nFinished with tests\n\n";

test.pl  view on Meta::CPAN


# Run in Cipher Block Chaining Mode.
use constant EIGHT_BYTE_BLOCKS => 20_000;
my $plaintext = PLAINTEXT x EIGHT_BYTE_BLOCKS;
my ($start, $end);
my $timediff = '';
my $des_driver = 'DES';
my $des_pp_driver = 'DES_PP';

# First pure Perl version.
print "Encrypting ", EIGHT_BYTE_BLOCKS << 3, " bytes in CBC mode...";
eval '
    use Crypt::CBC;
    
    my $cipher = Crypt::CBC->new (KEY, $des_pp_driver);
    my $start = Benchmark->new;
    $cipher->encrypt ($plaintext);
    my $end = Benchmark->new;
    $timediff = timestr timediff $end, $start;
';
print $@ ? " skipped (Crypt::CBC not loadable)\n" : 
    " done\n$timediff\n";

# Now the XS version.
print "XS-Version: Encrypting ", EIGHT_BYTE_BLOCKS << 3, 
    " bytes bytes in CBC mode...";
eval '
    use Crypt::CBC;
    
    my $cipher = Crypt::CBC->new (KEY, $des_driver);
    my $start = Benchmark->new;
    $cipher->encrypt ($plaintext);
    my $end = Benchmark->new;
    $timediff = timestr timediff $end, $start;
';
print $@ ? " skipped (Crypt::CBC or Crypt::DES not loadable)\n" : 
    " done\n$timediff\n";
$timediff = 0;

# Now with a non-cached key and 128 bytes of plaintext.
$plaintext = PLAINTEXT x 16;
print "Encrypting ", EIGHT_BYTE_BLOCKS, 
    " 128-byte-blocks in non-cached CBC mode...";
eval '
    use Crypt::CBC;
    
    my $start = Benchmark->new;

    for (1 .. EIGHT_BYTE_BLOCKS >> 3) {
	my $cipher = Crypt::CBC->new (KEY, $des_pp_driver);
	$cipher->encrypt ($plaintext);
    }
    my $end = Benchmark->new;
    $timediff = timestr timediff $end, $start;
';
print $@ ? " skipped (Crypt::CBC not loadable)\n" : 
    " done\n$timediff\n";
$timediff = 0;

$plaintext = PLAINTEXT x 16;
print "XS-Version: Encrypting ", EIGHT_BYTE_BLOCKS, 
    " 128-byte-blocks in non-cached CBC mode...";
eval '
    use Crypt::CBC;
    
    my $start = Benchmark->new;

    for (1 .. EIGHT_BYTE_BLOCKS >> 3) {
	my $cipher = Crypt::CBC->new (KEY, $des_driver);
	$cipher->encrypt ($plaintext);
    }
    my $end = Benchmark->new;
    $timediff = timestr timediff $end, $start;
';
print $@ ? " skipped (Crypt::CBC not loadable)\n" : 
    " done\n$timediff\n";
print "ok 1\n";

sub alarm_handler ($) {    
    my (undef, $endtime) = POSIX::times;

    $elapsed = $endtime - $starttime;
    
    die "alarm\n";
}



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