Apple’s NeuralHash Algorithm for CSAM Detection Has Been Extracted

Apple matrix code

Apple’s NeuralHash algorithm it will use to detect child sexual abuse material (CSAM) has been extracted from a device and rebuilt using Python.


Redditor u/AsuharietYgvar posted on Tuesday about their accomplishment. They say the algorithm can be found on devices as early as iOS 14.3. To be clear, this is not the CSAM detection system, but the algorithm used to generate hashes. The code is available on GitHub.

Here are the steps taken by the algorithm:

  1. Convert image to RGB.
  2. Resize image to 360×360.
  3. Normalize RGB values to [-1, 1] range.
  4. Perform inference on the NeuralHash model.
  5. Calculate dot product of a 96×128 matrix with the resulting vector of 128 floats.
  6. Apply binary step to the resulting 96 float vector.
  7. Convert the vector of 1.0 and 0.0 to bits, resulting in 96-bit binary data.

The model will run on macOS and Linux.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.