Search code examples
hashcoldfusionamazon-web-servicescoldfusion-9

How to calculate Amazon's MD5 hash for http request


Does anyone know how to calculate the MD5 hash that is needed to be used with Amazon's SubmitFeed API? I am using ColdFusion and every time I calculate the MD5 hash on my end it never matches what Amazon calculates.

Amazon responds with this error:

ContentMD5DoesNotMatch

the Content-MD5 HTTP header you passed for your feed (C7EF1CADB27497B46FCD6F69516F96E0) did not match the Content-MD5 we calculated for your feed (x+8crbJ0l7RvzW9pUW+W4A==)

I am using the built-in function that ColdFusion uses for hashing (example hash(myStr)). Is there a step I am missing?


Solution

  • I checked this online tool and you just need to send that MD5 in base64 encoding. It is currently just hexadecimal encoded.

    I'm afraid I don't know what the ColdFusion way to do that is, maybe this: SHA or MD5 Digests in ColdFusion