I am a bit confused about key derivation functions. I am trying to use the argon2
KDF from the passlib
python module to do the following:
- The user provides a password which I provide to the hash function combined with a salt (which is autogenerated by the function)
- I use the resulting hash as a master key to encrypt some other key(s) along with some data about some system, for example a set of files. The salt is also stored along this data (but not encrypted).
My confusion comes from the fact that the library only provides the hash results in the form of strings which may be used to identify if the user of some website typed in the correct password, for example the string
'$argon2i$v=19$m=512,t=2,p=2$aI2R0hpDyLm3ltLa+1/rvQ$LqPKjd6n8yniKtAithoR7A'
as shown in this example.
Can I use a KDF like argon2
for this purpose? Of course I would have to extract the key and the salt along with the settings from this string to make this work.
-e
and-r
from this github.com/P-H-C/phc-winner-argon2 $\endgroup$