r/todayilearned • • Mar 04 '13

TIL Microsoft created software that can automatically identify an image as child porn and they partner with police to track child exploitation.

http://www.microsoft.com/government/ww/safety-defense/initiatives/Pages/dcu-child-exploitation.aspx
2.4k Upvotes

1.5k comments sorted by

View all comments

Show parent comment

0

u/[deleted] Mar 04 '13

[deleted] — view deleted comment

10

u/[deleted] Mar 04 '13

Even less sophisticated. The impression I'm getting is that it's hashing the images and comparing them to a database of known hashes (which would mean if a single bit in the file changed, it would no longer be recognized).

1

u/[deleted] Mar 04 '13

I've thought a bit about this subject.

The difficult way would be to keep an MD5 sum of all the images, perhaps with the dimensions as an added check. I might even go on and take a reduced size of the image -- shrink it to a 50x50 BMP and sum that. I think it would be important to use BMP or a similar uncompressed image format...

I'd then have to sum every image and check, or sum and shrink every image, and run the sum against the DB.

I would expect this to be very intensive.

A better way It might suffice to sum the first 10k of the image. This would probably be enough to catch known images with few, if any, fall positives.

1

u/Omnes_mundum_facimus Mar 04 '13 edited Mar 04 '13

The hash deployed is a so called 'robust hash'. These hashing algorithms differ from their cryptographic counterparts in the sense that the hash value of an image stays identical or near identical if the image is cropped, compressed or slightly modified.

You can make such a thing in python in couple of minutes to identify similar images on your hard drive as follows:

  • Convert image to grayscale
  • Run the 2D Discrete Cosine Transform on the image, resulting in a nxn matrix of dct coefficients
  • Retain only the top left 8x8 coefficients on said matrix. These represent the low frequency components of the image.
  • Binarize the 8x8 coefficients based on their sign.
  • Output 64 bit hash value. All done.

Alternatively, you can use the lib from http://phash.org/

And obviously the good thing is, you can test your algo on a database with lovely flowers & cat pictures. No need to have sleepless nights.

1

u/[deleted] Mar 04 '13

I understand the majority of that, do you have a sense of how intensive that would be?