Let's say I have an unknown string with the known sha256-hash of it. I was wondering if it was possible to now calculate the sha256 of the concatenation of the unknown string and "abc".
(In PHP: hash('sha256', $unknownString .'abc');
)
I thought in order to do so "all I need" is to go from the hash that I know back to the midstate of the sha256 algorithm (in most implementations called finalize
) and append the data that I want (via, in most implementations called, update
) and then call finalize
again. Block lengths shouldn't be a problem because the unknown string has a length of 256 bit and my own string has this as well.
Is this possible or by the way sha256 is designed impossible to achieve?
PS: I have no intention in getting the unknown string. I absolutely do not care about the plaintext contents of this.
abc
; but yes for some slightly longer extensions (possibly ending inabc
), and assuming the length of $unknownString is known. $\endgroup$