0

i have been fiddling with creating a signature for AWS (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html) and i was going through the first diagram (in the link) and in the first example

Hex(SHA256HASH(CanonicalRequest)) 

gave them the string

3bfa292879f6447bbcda7001decf97f4a54dc650c8942174ae0a9121cf58ad04

But when i placed the same CanonicalRequest string they used into a online hash generator (eg:https://emn178.github.io/online-tools/sha256.html). I got back the same string as them

Where in this example:

1) Hex() ==> Lowercase base 16 encoding

2) SHA256Hash() ==> Secure Hash Algorithm (SHA) cryptographic hash function


Can someone explain the difference between:

Hex(SHA256HASH(some_string))

vs (if i just sha256 hash the string)

SHA256HASH(some_string)

thanks!

Red
  • 65
  • 1
  • 7
  • 1
    SHA-256 is an algorithm that operates on bytes, and returns bytes. How these bytes are represented depends on the environment. Outside of a programming language, it would be very common to represent bytes as a hexstring, meaning no further explicit transformation to a string is needed. Within a programming language, there's typically a dedicated type to a collection of bytes (like `byte[]`) that cannot simply be inserted into a string directly, hence the mention of this transformation. – Jeroen Mostert Jan 05 '20 at 14:11
  • oh.... understood thks! – Red Jan 06 '20 at 05:23

0 Answers0