1

I need to find the SHA256 hash of s string like this: part1-part2. I know the SHA256(part1), length of part1 and I know part2, but I don't know what is the contents of part1.

Is there any chance I can compute the hash of the whole string using only these three parts of information?

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240
Daniel
  • 113
  • 4

1 Answers1

1

As @yyyyyy already commented: if you are able to successfully apply a length extension attack, you would be able to compute

$$\operatorname{SHA256}(\mathit{secret}\Vert\mathit{padding}\Vert\mathit{data})$$

But computing $\operatorname{SHA256}(\mathit{secret}\Vert\mathit{data})$ for freely chosen $\mathit{data}$ without the $\mathit{padding}$ in between is assumed to be “hard”; meaning that you’ll end up having to brute-force your way towards a result.

Also see “understanding a length extension attack” for a more indeep understanding of things.

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240