I have code where someone made the key 64 bytes (32*2) and passes to the derive_key() function. It then uses the key created for aes_encrypt_key256() which would only use 32 bytes.

Is there any good reason why the code is doing that vs just using a 32 byte key that is passed to derive_key() ?


  • $\begingroup$ Not a clear question. What do you expect, run another KDF at that point? $\endgroup$
    – kelalaka
    Mar 2 at 22:46
  • $\begingroup$ The question is in terms is it more secure to do it with the 64 bytes to derive_key() vs doing it with just 32 bytes ? $\endgroup$ Mar 3 at 7:22
  • $\begingroup$ This is not a programming Q/A site, but I do think that the question is valid. That said please indicate a reference to the language and the actual function being called. It is also very important to include the context, otherwise we may not be able to guess why a KDF is being used in a protocol. I'll close the question until these details are added (by hitting edit). $\endgroup$
    – Maarten Bodewes
    Mar 5 at 18:19


Browse other questions tagged or ask your own question.