2

Argon2 v1.3 is the algorithm used by python module argon2-cffi.

In the documentation they state the following:

"argon2-cffi implements Argon2 version 1.3, as described in in: Argon2: the memory-hard function for password hashing and other applications."

Yet this document does not specify the actual use of any "flavour" (i/d/id), it just explains the differences.

What "flavour" is used by argon2-cffi by default? Is there a way to specify the "flavour" you want to use?

1 Answers1

3

Judging from the return value of the hash function in class PasswordHasher from argon2-cffi, it appears it can be concluded that the hybrid "flavour" is used by default.

from argon2 import PasswordHasher

PasswordHasher().hash("foo")

Returns:

"$argon2id$v=19$m=65536,t=3,p=4$xIu1KPUI7Ofe6HxYhmbNiA$6q7HjVOe6933Ogaw0f7pLodCdBgJsST8JAszTkv4Jh4"

This is confirmed by the comment in said class:

Uses Argon2\ **id** by default and always uses a random salt_ for hashing. But it can verify any type of Argon2 as long as the hash is correctly encoded.

Changing the "flavour" used by the module is done by assigning the variable type of class PasswordHasher to a Type class defined in like so:

from argon2 import PasswordHasher, Type
PasswordHasher(type=Type.I).hash("foo")  # lib.Argon2_i
PasswordHasher(type=Type.D).hash("foo")  # lib.Argon2_d
PasswordHasher(type=Type.ID).hash("foo") # lib.Argon2_id

Each of these Type variables reference a corresponding argon2 library, shown in comments.