I am trying to use argon2 hash to derive secret key to be used for AES-GCM , in package argon2-cffi in python there is a function argon2.low_level.hash_secret_raw(secret: bytes, salt: bytes, time_cost: int, memory_cost: int, parallelism: int, hash_len: int, type: argon2.low_level.Type, version: int = 19) → bytes¶ , I read docs from here https://argon2-cffi.readthedocs.io/en/stable/api.html#module-argon2.low_level but couldn't understand if raw hash can be used as secret key


1 Answer 1


Yes, the output of Argon2 is safely usable as a symmetric key, as long as

  1. it is not used for anything else
  2. it is of size equal to the key size
  3. both the Argon2 output and symmetric key are unencoded, or use the same encoding (e.g. hex or base64)
  4. parameterization of Argon2 (time_cost, memory_cost, parallelism) is ample enough given the quality of the password input, and the stakes.

If it's desired to use the same input (e.g. password) for multiple uses, it's possible to set the hash_len parameters to the total output desired, and split it.

  • 1
    $\begingroup$ TL;DR Yes a Password Based Key Derivation Method (PBKDF) such as Argon2 can be used to produce keys as long as the input / configuration requirements are met. $\endgroup$
    – Maarten Bodewes
    Jul 22, 2022 at 8:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.