4
$\begingroup$

For example, I have:

  • Unknown: A secret variable, lets call it secret, that is unknown to me
  • Known: The length of secret, (lets say 128 bytes)
  • Known: The hash of secret, in hash1 (lets say hash1 is sha512, this is an important part of the question since hash1 isn't hash2)

My objective here is to get hash2(secret || data_that_I_know), but hash2 being different than hash1, (lets say hash2 is sha1).

With my current understanding of the length extension attack I believe I can obtain the digest of hash1(secret || data_that_I_know), but, is it possible to get the digest from another hash type (like sha256, md5 etc.)?

$\endgroup$
4
$\begingroup$

This is not possible in general, or for the specific case of SHA1 and SHA512. Length extension works because MD-hashes iterate the same function, so knowing the output you also know the intermediate state for some related longer inputs.

Now there are some cases with "different" hashes where it could be possible. That its when the hashes are related. Like SHA512 -> SHA512/500 or another such truncated hash that uses the same IV and compression function.

In that case you can use the normal length extension attack and just truncate the final output.

| improve this answer | |
$\endgroup$

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.