I know how to calculate the entropy of a key that relates to its selection process. For example if the key space is $1000$, entropy of a randomly chosen key is $1000$. Suppose now you have two keys $X$ and $Y$. The finale key $Z$ is a concatenation of $X$ and $Y$. There are two ways to combine. One is to use XOR and other way is to use a Key Based Key Derivation Function (KBKDF) such as HKDF. I want to know how to calculate the entropy of $Z$ when…

  • $Z$ = $X$ XOR $Y$
  • $Z$ = HKDF($X$,$Y$)

In the XOR case should I use mutual information of $X$ and $Y$?


1 Answer 1


With proper hashing the entopy of $Z$ is roughly the sum of both individual entropies, capped to the strength of the hash-function. For SHA-256 the limit is 256 bits, for SHA-512 it's 512 bits. Since entropy above 256 bits is meaningless, this isn't a practical limitation.

For XOR computing the entropy of $Z$ is tricky and depends on how your keys are distributed. It's probably only as strong as the stronger of the two key, which is clearly worse than the sum. If the keys are correlated it might even fail catastrophically.

=> Use HKDF with a good underlying hash

  • $\begingroup$ Hi can you show me reference where I can show this mathematically?? $\endgroup$
    – deltaaruna
    Commented Nov 5, 2013 at 6:43

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.