Crypt-CAST5_PP

 view release on metacpan or  search on metacpan

CAST5_PP.pm  view on Meta::CPAN

package Crypt::CAST5_PP;

require 5.004;
use strict;
use AutoLoader qw( AUTOLOAD );
use Carp;
use integer;
use vars qw( @s1 @s2 @s3 @s4 @s5 @s6 @s7 @s8 $VERSION );

$VERSION = "1.04";

sub new {
  my ($class, $key) = @_;
  my $cast5 = { };
  bless $cast5 => $class;
  $cast5->init($key) if defined $key;
  return $cast5;
} # new

sub blocksize { return 8  }
sub keysize   { return 16 }

1 # end module
__END__

=head1 NAME

Crypt::CAST5_PP - CAST5 block cipher in pure Perl

=head1 SYNOPSIS

    use Crypt::CBC;

    my $crypt = Crypt::CBC->new({
        key    => "secret key",
        cipher => "CAST5_PP",
    });

    my $message = "All mimsy were the borogoves";
    my $ciphertext = $crypt->encrypt($message);
    print unpack("H*", $ciphertext), "\n";

    my $plaintext = $crypt->decrypt($ciphertext);
    print $plaintext, "\n";

=head1 DESCRIPTION

This module provides a pure Perl implementation of the CAST5 block cipher.
CAST5 is also known as CAST-128. It is a product of the CAST design
procedure developed by C. Adams and S. Tavares.

The CAST5 cipher is available royalty-free.

=head1 FUNCTIONS

=head2 blocksize

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

=head2 keysize

Returns the maximum CAST5 key size, 16 bytes.

=head2 new

    $cast5 = Crypt::CAST5_PP->new($key);

Create a new encryption object. If the optional key parameter is given,
it will be passed to the init() function.

=head2 init

    $cast5->init($key);

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.918 second using v1.00-cache-2.02-grep-82fe00e-cpan-1925d2aa809 )