I'm building an app that's kind of a canvas-paint art generator. The details aren't important - what is important is ensuring that the same image is never saved twice.
It's fine if the same image is generated more than once, but before it gets saved I need to check all images to-date for an identical copy. Eventually there are going to be thousands - even millions - of these images, so it's pretty unreasonable to store the raw files and check every single one against the active. Is there a way to reduce an image file to a unique key or string?
I considered some kind of SHA conversion - it would be really easy to check an image's hash against a table of logged hashes - but there is a distressing lack of information on the topic, and SHA has a small possibility of duplicates. Any help is appreciated - thanks!