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.

More...
  1. Hash!TDigest makeHash(Password password, Salt salt = randomSalt(), Salter!TDigest salter = toDelegate(&defaultSalter!TDigest))
    Hash!TDigest
    makeHash
    (
    TDigest = DefaultDigest
    )
    (
    ,
    Salt salt = randomSalt()
    ,
    Salter!TDigest salter = toDelegate(&defaultSalter!TDigest)
    )
    if (
    isDigest!TDigest
    )
  2. Hash!TDigest makeHash(Password password, Salter!TDigest salter)
  3. Hash!Digest makeHash(Digest digest, Password password, Salt salt = randomSalt(), Salter!Digest salter = toDelegate(&defaultSalter!Digest))
  4. Hash!Digest makeHash(Digest digest, Password password, Salter!Digest salter)

Detailed Description

Optional Params

salt - Default value is 'randomSalt()'

salter - Default value is 'toDelegate(&defaultSalter!TDigest)'

Meta