0
$\begingroup$

I have created a text file called test.txt and the content of the file is Hello World
I would like to change the SHA checksum hash without modifying the contents and filename. Is there any way to do that without using any third party tool on the internet.

$\endgroup$
1
  • 4
    $\begingroup$ What are you trying to do? $\endgroup$
    – Alice Ryhl
    Feb 4, 2019 at 20:49

1 Answer 1

9
$\begingroup$

Hash functions are deterministic, same input same output. Without a modification, you cannot change the result.

The hash of a file is used at least for the integrity check. If you were able to change it without modification the integrity check will have problems.

Note: as mentioned by Ella Rose in the comments if a keyed-hash message authentication code HMAC is used then changing the key will result in a different hash-based message authentication code.

$\endgroup$
2
  • 4
    $\begingroup$ They might be able to use some kind of keyed hash function, depending on their use case. But that won't be SHA256 anymore either. $\endgroup$
    – Ella Rose
    Feb 4, 2019 at 20:03
  • $\begingroup$ @EllaRose Yes, if it is a keyed function then changing the key will changed the result. Added, thanks. $\endgroup$
    – kelalaka
    Feb 4, 2019 at 20:10

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.