NAME
Authen::Passphrase::SaltedDigest - passphrases using the generic salted digest algorithm
SYNOPSIS
use Authen::Passphrase::SaltedDigest;
$ppr = Authen::Passphrase::SaltedDigest->new(
algorithm => "SHA-1", salt => "my",
hash_hex => "301ce40d1b5ceb0919c9".
"f26e1d7aff880a886f7b");
$algorithm = $ppr->algorithm;
$salt = $ppr->salt;
$salt_hex = $ppr->salt_hex;
$hash = $ppr->hash;
$hash_hex = $ppr->hash_hex;
if($ppr->match($passphrase)) { ...
$userPassword = $ppr->as_rfc2307;
DESCRIPTION
An object of this class encapsulates a passphrase hashed using a generic digest-algorithm-based scheme. This is a subclass of Authen::Passphrase
, and this document assumes that the reader is familiar with the documentation for that class.
The salt is an arbitrary string of bytes. It is appended to passphrase, and the combined string is passed through a specified message digest algorithm. The output of the message digest algorithm is the passphrase hash.
The use of this passphrase scheme is recommended for new systems. The strength depends entirely on the choice of digest algorithm, so choose according to the level of security required. SHA-1 is suitable for most applications, but recent work has revealed weaknesses in the basic structure of MD5, SHA-1, SHA-256, and all similar digest algorithms. A new generation of digest algorithms will probably emerge sometime around 2008.
CONSTRUCTOR
- Authen::Passphrase::SaltedDigest->new(ATTR => VALUE, ...)
-
Generates a new passphrase recogniser object using the generic salted digest algorithm. The following attributes may be given:
- algorithm
-
A string identifying the message digest algorithm to use. It must be understood by
Digest->new
. - salt
-
The salt, as a raw string of bytes. Defaults to the empty string, yielding an unsalted scheme.
- salt_hex
-
The salt, as a string of hexadecimal digits. Defaults to the empty string, yielding an unsalted scheme.
- hash
-
The hash, as a string of bytes.
- hash_hex
-
The hash, as a string of hexadecimal digits.
The digest algorithm and hash must both be given.
METHODS
- $ppr->algorithm
-
Returns the digest algorithm, as a string that can be passed to
Digest->new
. - $ppr->salt
-
Returns the salt, in raw form.
- $ppr->salt_hex
-
Returns the salt, as a string of hexadecimal digits.
- $ppr->hash
-
Returns the hash value, in raw form.
- $ppr->hash_hex
-
Returns the hash value, as a string of hexadecimal digits.
- $ppr->match(PASSPHRASE)
- $ppr->as_rfc2307
-
These methods are part of the standard
Authen::Passphrase
interface. Only passphrase recognisers using certain well-known digest algorithms can be represented in RFC 2307 form.
SEE ALSO
Authen::Passphrase, Crypt::Passwd
AUTHOR
Andrew Main (Zefram) <zefram@fysh.org>
COPYRIGHT
Copyright (C) 2006 Andrew Main (Zefram) <zefram@fysh.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.