I'm working on an app that, among other things, downloads images from the web. Some of my testers are finding that images fails to download. In some cases, downloading fails in the middle. The image that ends up on displaying is something like this:
The intended image looks like this:
The app consumes the URLs from an API. I'd like to use, say, a SHA1 checksum to verify that the image is downloaded, like so:
- The app requests image information, including the URL and the checksum.
- The app attempts to download the image.
- The app hashes and compares the downloaded image with the hash from the server.
Do I have this right? Will this kind of hashing help detect downloads that fail halfway?