0
$\begingroup$

If I have a high entropy key (ECDHE shared secret), what type of hash should I use to format this into an AES-256 key? Is Sha256 or Sha3_256 sufficient to maintain entropy or do I need to use a KDF (Scrypt / Argon2) and exchange the salt during the handshake??

$\endgroup$
4
$\begingroup$

I seem to recall that shared secret keys should be hashed before using as encryption keys (some brief discussion here).

If your key is already high-entropy, then hashing with SHA256 is fine. If you plan to generate several keys (ie, encryption and HMAC) from the original shared secret, then HKDF is a good option. This is a key-based KDF.

Scrypt and Argon2 are password-based KDFs and are not appropriate - they're designed for low-entropy input (such as passwords).

$\endgroup$
  • $\begingroup$ I need to derive a key for encryption and one for a hmac, so I'll look into the HKDF. Thanks $\endgroup$ – SamG101 Oct 17 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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