For example I want to send text document with content:
---start of hello.txt--- Hello world! SHA-256 hash of this document is: e5cefc21ce1131cc0e8759f5e3b46c016319883c6f9b0d714502f3cf7226864f ---end of hello.txt---
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.Sign up to join this community
No. It is a problem akin to that of the self-enumerating pangram, but since the hash function is not reversible, the only way of doing this is by brute force. Given the size of the key space, this is unfeasible.
I guess you could potentially include a hash of the other content in the file in the file - e.g.
---START CONTENT--- some content ----END CONTENT--- Hash of CONTENT: sha256:aaaaf
It isn't clear what that achieves, though, because anyone able to intercept the message can replace both the content and hash - something using e.g. HMAC would prevent.