1
$\begingroup$

Are there any cryptographically strong hash function and encryption function(s) where hash(encryptA(data)) == encryptB(hash(data)). The functions encryptA() and encryptB() may be identical, or just related.

If no such functions currently exist, are there theoretical reasons (relating to the one-way nature of hash functions) why they cannot exist?

$\endgroup$
2
  • 1
    $\begingroup$ So, basically you are asking are there two permutation that a permutation before hash equal to another permutation after hash. We hope not such simple relation exist in cryptographically secure hash functions. $\endgroup$
    – kelalaka
    Oct 13 at 12:58
  • $\begingroup$ Thanks, that shows why it would not be a good hash function. Related: crypto.stackexchange.com/questions/108282/… $\endgroup$
    – fadedbee
    Oct 13 at 13:05

1 Answer 1

1
$\begingroup$

I'll show a strange result under some assumptions.

Consider the simplified notation;

$$H(E(d,k_1)) = E(H(d),k_2) \label{r1}\tag{1}$$

and for simplicity, assume the hash output is 128-bit.

Now, consider that one finds two 128-bit inputs $a \neq b$ such that $H(a) = H(b)$, i.e. we have a colliding pair.

The right-hand side of eqn. (\ref{r1}) with the input $a$ and $b$. Then

$$E(H(a),k_2) = E(H(b),k_2) \label{r2}\tag{2}$$

since $a$ and $b$ is a collision. Now consider the left side;

$$H(E(a,k_1)) = H(E(b,k_1)) \label{r3}\tag{3}$$ This equality holds since the right sides are equal.

Now, for this equality, either

  • $E(a,k_1) = E(b,k_1) $ This is not possible since $a \neq b$

  • then we may have $E(a,k_1) \neq E(b,k_1) $ I.e. we have very unlucky that $E(a,k_1) = b$ and $E(b,k_1) = a$.

    If we do not consider that unlucky case ($\dfrac{1}{2^{128}}$ probability), than we have another colliding pair!

Now, use them again to get another pair, the use them another pair...

Where this will stop, I have no idea, however, we may consider that the best solution for our secure cryptographic hash function is this;

  • The encryptions are identity maps.

Well, one may consider the output size of the hash functions as 256 or more, with ECB mode encryption or others. This may require a different analysis, that I will not consider, however, we showed that this requirement is not good for secure cryptographic hash functions.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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