KhaosT/nhcalc

An implementation without the need of iOS or macOS environment

Opened this issue · 3 comments

First of all, thanks for sharing your findings of this private api!

I have created AppleNeuralHash2ONNX, which can convert Apple's model to ONNX, by doing reverse-engineering on this API. It can be used to calculate neural hash with onnxruntime, even on Linux.

One suggestion: The API returns 96-bit binary data encoded in base64. You can decode it to raw binary and encode again with hex. This will result in 24 hex characters instead of 32 produced here, making it easier to do bitwise comparisons.

That's really cool 🙏 Hopefully these tools will help researcher to better measure NeuralHash's collision rates.

Indeed. In theory you can train a GAN using the exported ONNX model as the discriminator. Then you can use the generator to generate a random image for any input hash. This can be used to spam Apple with endless false positives if we can also export the CSAM database on device.

if we can also export the CSAM database on device

No you can't.

image