Cannot use VerifyEncoded when mode is argon2id
sinnlosername opened this issue · 0 comments
sinnlosername commented
Hey.
It's impossible to verify an encoded hash when using argon2id. I did some testing and it seems like it's related to the following code:
func getMode(s string) (int, error) {
switch {
case strings.HasPrefix(s, "$argon2d"):
return ModeArgon2d, nil
case strings.HasPrefix(s, "$argon2i"):
return ModeArgon2i, nil
case strings.HasPrefix(s, "$argon2id"):
return ModeArgon2id, nil
default:
return -1, ErrDecodingFail
}
}
"argon2id" also starts with "argon2i", so it's recognized as the wrong hash type, which will cause an error when calling C.argon2_verify