Sha512 custom password specifying iterations?

Like the example in this thread entitled Importing users with custom password hash

const getHash = (string) => crypto
  .createHash('sha256')
  .update(string)
  .digest('hex');

    const passwordPlain = 'hello'
    const salt = '1234'
    let passwordToHash = salt + passwordPlain

    for (let i = 0; i < 100; i++) {
      passwordToHash = getHash(passwordToHash);
    }
    console.log(passwordToHash)
// 35e7f5fc530c66ee830fd7d53f8d489b467a3edd81fbd2412947897d6bef12c0

Wouldn’t you need to specify 100 iterations when importing? I don’t see in the docs or this example import from the docs where you could specify the number of hash iterations.

{
        "email": "mary@contoso.com",
        "email_verified": false,
        "custom_password_hash": {
            "algorithm": "sha256",
            "hash": {
                "value": "d24e794fce503c3ddb1cd1ba1dd5d9b250cf9917336a0316fefd87fecf79200f",
                "encoding": "hex"
            },
            "salt": {
                "value": "abc123",
                "position": "prefix"
            }
        }
    },

Hi @gcorey

Welcome to the Auth0 Community!

Based on this Knowledge Article → Importing password hash made by PHP fails, Auth0 only accepts the password hashes that were passed through the Algorithm, like SHA256, only once, not looped multiple times.

Thanks!
Dawid

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.