kmaragon / Konscious.Security.Cryptography

MIT License
202 stars 20 forks source link

Allow passwords of zero length #37

Open andreimilto opened 4 years ago

andreimilto commented 4 years ago

Currently a password of zero length causes ArgumentException in the constructor:

public Argon2(byte[] password)
{
    if (password == null || password.Length == 0)
        throw new ArgumentException("Argon2 needs a password set", nameof(password));

    _password = password;
}

However, using a password of zero length as an input for Argon2 is an accepted practice:

So, it would be nice to see the support of zero-length passwords here.