Crypt::Eksblowfish::Family.3pm

Langue: en

Autres versions - même langue

Version: 2008-05-08 (debian - 07/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

Crypt::Eksblowfish::Family - Eksblowfish cipher family

SYNOPSIS

         use Crypt::Eksblowfish::Family;
 
         $family = Crypt::Eksblowfish::Family->new_family(8, $salt);
 
         $cost = $family->cost;
         $salt = $family->salt;
         $block_size = $family->blocksize;
         $key_size = $family->keysize;
         $cipher = $family->new($key);
 
 

DESCRIPTION

An object of this class represents an Eksblowfish cipher family. It contains the family parameters (cost and salt), and if combined with a key it yields an encryption function. See Crypt::Eksblowfish for discussion of the Eksblowfish algorithm.

It is intended that an object of this class can be used as the ``-cipher'' parameter to "Crypt::CBC" and similar systems. Normally that parameter is the name of a class, such as ``Crypt::Rijndael'', where the class implements a block cipher algorithm. The class provides a "new" constructor that accepts a key. In the case of Eksblowfish, the key alone is not sufficient. An Eksblowfish family fills the role of block cipher algorithm. Therefore a family object is used in place of a class name, and it is the family object the provides the "new" constructor.

CONSTRUCTOR

Crypt::Eksblowfish::Family->new_family(COST, SALT)
Creates and returns an object representing the Eksblowfish cipher family specified by the parameters. The SALT is a family key, and must be exactly 16 octets. COST is an integer parameter controlling the expense of keying: the number of operations in key setup is proportional to 2^COST.

METHODS

$family->cost
Extracts and returns the cost parameter.
$family->salt
Extracts and returns the salt parameter.
$family->blocksize
Returns 8, indicating the Eksblowfish block size of 8 octets.
$family->keysize
Returns 0, indicating that the key size is variable. This situation is handled specially by "Crypt::CBC".
$family->new(KEY)
Performs key setup on a new instance of the Eksblowfish algorithm, returning the keyed state. The KEY may be any length from 1 octet to 72 octets inclusive. The object returned is of class "Crypt::Eksblowfish"; see Crypt::Eksblowfish for the encryption and decryption methods.

Note that this method is called on a family object, not on the class "Crypt::Eksblowfish::Family".

$family->encrypt
This method nominally exists, to satisfy "Crypt::CBC". It can't really be used: it doesn't make any sense.

SEE ALSO

Crypt::CBC, Crypt::Eksblowfish

AUTHOR

Andrew Main (Zefram) <zefram@fysh.org> Copyright (C) 2006, 2007, 2008 Andrew Main (Zefram) <zefram@fysh.org>

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.