1

How can I get an MD5 checksum of an image at a specific URL in JavaScript? I would like to write a function like this:

var checksum = imageMD5Checksum('http://link.to/image.jpg');

which would return an MD5 checksum string of the image (e.g. 'f0bf4ed11b011217bdb46f8d7b08dea2').

meriken2ch
  • 409
  • 5
  • 15
  • You can use `XMLHttpRequest` to get the image data, then use a JavaScript hashing library to generate a MD5 of the image data. – Zoey Mertes Oct 11 '14 at 03:53
  • I keep getting the following error in Chrome: `No 'Access-Control-Allow-Origin' header is present on the requested resource.` I know I could resolve the issue by modifying the response header, but I would like my function to work with any external image links. Any ideas? – meriken2ch Oct 11 '14 at 04:17
  • i for one would NOT like your function to work on any site's images. follow the rules or get a server. – dandavis Oct 11 '14 at 04:43
  • Not javascript, but hopefully useful to someone who lands on this page: `curl 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png' | md5sum` – Sridhar Sarnobat Mar 11 '17 at 22:58

1 Answers1

0

I ended up setting up a proxy server for image downloads. Thanks a lot for pointers!

meriken2ch
  • 409
  • 5
  • 15