Rechercher une page de manuel
Crypt::OpenPGP::Digest.3pm
Langue: en
Version: 2001-08-10 (mandriva - 01/05/08)
Section: 3 (Bibliothèques de fonctions)
NAME
Crypt::OpenPGP::Digest - PGP message digest factorySYNOPSIS
use Crypt::OpenPGP::Digest;
my $dgst = Crypt::OpenPGP::Digest->new($name); my $hashed_data = $dgst->hash($data);
DESCRIPTION
Crypt::OpenPGP::Digest is a factory class for PGP message digest objects. All digest objects are subclasses of this class and share a common interface; when creating a new digest object, the object is blessed into the subclass to take on algorithm-specific functionality.A Crypt::OpenPGP::Digest object wraps around a function reference providing the actual digest implementation (eg. Digest::MD::md5 for an MD5 digest). This allows all digest objects to share a common interface and a simple instantiation method.
USAGE
Crypt::OpenPGP::Digest->new($digest)
Creates a new message digest object of type $digest; $digest can be either the name of a digest algorithm (in Crypt::OpenPGP parlance) or the numeric ID of the algorithm (as defined in the OpenPGP RFC). Using an algorithm name is recommended, for the simple reason that it is easier to understand quickly (not everyone knows the algorithm IDs).
Valid digest names are: "MD5", "IDEA", and "RIPEMD160".
Returns the new digest object on success. On failure returns "undef"; the caller should check for failure and call the class method errstr if a failure occurs. A typical reason this might happen is an unsupported digest name or ID.
$dgst->hash($data)
Creates a message digest hash of the data $data, a string of octets, and returns the digest.
$dgst->alg
Returns the name of the digest algorithm (as listed above in new).
$dgst->alg_id
Returns the numeric ID of the digest algorithm.
AUTHOR & COPYRIGHTS
Please see the Crypt::OpenPGP manpage for author, copyright, and license information.Contenus ©2006-2024 Benjamin Poulain
Design ©2006-2024 Maxime Vantorre