Hello,
As I've been tinkering with the new URL filtering API I've been struggling to create bloom filters. I have been referencing this developer's post heavily: https://developer.apple.com/forums/thread/791352?answerId=851527022#851527022
He suggests that the expected FNV-1a implementation has the multiply and xor operations inverted, while an Apple engineer suggests that this will be updated on the offical iOS26 release (which has already happened). What is the "correct" FNV-1a implementation?
In this sample project (which is from july, so pre-release ios 26): https://developer.apple.com/documentation/networkextension/filtering-traffic-by-url
Is the included bloom filter data correct? I can only assume the other developer used this as a reference to then conclude that multiplying and xor-ing should be inverted, so I'm really not sure if this bloom filter bitVectorData here is trustworthy.
Is there any reference implementation for this hashing procedure? How do we generate a bloom filter properly and know that it is correct?
The official iOS26 and macOS26 release has the Bloom filter using the FNV-1a implementation.
For reference, here is a generic implementation of FNV-1a:
hash = 0x811c9dc5
prime = 0x01000193
for each byte, b, of data:
hash = hash ^ b
hash = hash * prime
The current published sample project does not include the correct Bloom filter data. The next version of the sample project will be corrected and is coming soon.