Search code examples
cryptographysystem.security

Transforming a password to a 256-bit key


I have a file encrypted with AES using a 256-bit (or 128-bit) key. Passing to and asking the file owner to keep the 256-bit key would be humanly difficult.

How can a more friendly password be used by the owner to remember or retrieve the actual 256-bit key?


Solution

  • For this kind of issues, we have Key Derivation Functions (KDF), as Argon2, PBKDF2, or BCrypt. Argon2 was the winner of Password Hashing Competition. You can see a detailed answer in crypto.stackexchange

    In your case, first, you need to choose a password, and use it to generate a key by a KDF for the AES encryption then use this key to encrypt. Depend on the security you may use the random input to increase the entropy, though it will be hard to remember, too.

    You can also encode the AES key into base64, however, it will not be easily remembered either.

    Note: you can also transfer it with a small Veracrypt Volume.