Function makeHash
Generates a salted password
using any Phobos-compatible digest
, default being SHA-512.
(Note: An established "key stretching" algorithm
( http://en.wikipedia.org/wiki/Key_stretching#History ) would be an even
better choice of digest
since they provide better protection against
highly-parallelized (ex: GPU) brute-force attacks. But SHA-512, as an SHA-2
algorithm, is still considered cryptographically secure.)
Supports both template-style and OO-style digests. See the documentation of std.digest.digest for details.
Salt
is optional. It will be generated at random if not provided.
Normally, the salt
and password
are combined as (psuedocode) 'salt
~password
'.
There is no cryptographic benefit to combining the salt
and password
any
other way. However, if you need to support an alternate method for
compatibility purposes, you can do so by providing a custom salter
delegate.
See the implementation of DAuth's defaultSalter
to see how to do this.
If using an OO-style Digest, then digest
MUST be non-null. Otherwise,
an UnknownDigestException
will be thrown.
Prototypes
Hash!TDigest makeHash(TDigest)( Password password, Salt salt, Salter!TDigest salter ); Hash!TDigest makeHash(TDigest)( Password password, Salter!TDigest salter ); Hash!Digest makeHash()( Digest digest, Password password, Salt salt, Salter!Digest salter ); Hash!Digest makeHash()( Digest digest, Password password, Salter!Digest salter );
Optional Params
salt
- Default value is 'randomSalt()'
salter
- Default value is 'toDelegate(&defaultSalter
!TDigest)'