3

When I am running through an example for Sha256 I am not understanding how to arrive at the right answer. If I use the following Hex string:

3ebb2d68d7007148b184e57bba9697d76bc04141155c57f97e3b92c5fd6a46bd

and run this through sha256, I get the following:

5f2edbb41f884a99227aedaeb5dd1739431e531d1e7be2a19976839bf9ccc17f

However, if I go the website: https://anyhash.com/sha256?hello and run the same example through sha256, but with the Hex checkbox ticked off, I get the expected result I am looking for:

ff277f1f11cd72effe537f5e8a2690e08d8c911682d8a8150000000000000000

Can someone explain to me what it is doing when I check off that Hex checkbox? It would be helpful to know what I am transforming the Hex string into in order to run it through sha256 without having to check hex box.

0

When that "hex" check box is ticked, it tells the website to interpret the hex string that you entered as representing hexadecimal bytes, i.e. binary data. Normally when you just hash that hex string, it is interpreted as a string, i.e. a sequence of characters. But you really want to hash the binary data that that string represents, and that is what that hex checkbox lets you do.

  • How does that interpretation work? If I was writing my own program, the pseudo code would be: Find Hex string -> convert to binary form -> sha256? Does this mean that if I enter the binary format in that site, without checking that box, it should provide the same answer? – ghawes Jan 5 '18 at 0:04
  • It's not just convert to binary form but rather parse the hex string as representing bytes. The string itself has a binary form, but that form is different from the binary that the string represents. Once you have parsed the string, then you hash that data. If you were to represent the binary form as human readable text, that text would be a string that is half as long and usually filled with junk characters unless the hex string specifically represented data that corresponds to human readable text. If you entered the text that you got into a hasher, then you would get the correct result. – Andrew Chow Jan 5 '18 at 0:24
  • I don't know why this took me so long to understand, but after rereading your comment a few times, I finally get it. Thank you! – ghawes Jan 5 '18 at 6:27

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.