Is there any algorithm that preserves prefix property of IP?
I'm not sure what you mean. Could you give an example?
Ok. Suppose I have bunch of IP's having same network id like,
here netmask id 255.255.0.0
So after anonymization these should look like,
Here I mean that NID should get same hash value. So after anonymization, I should able to figure out that these bunch of IPs belongs to same subet.
This sounds close to what the fingerprint filter does with
method => "IPV4_NETWORK":
If set to
IPV4_NETWORKthe input data needs to be a IPv4 address and the hash value will be the masked-out address using the number of bits specified in the
keyoption. For example, with "22.214.171.124" as the input and
keyset to 16, the hash becomes "126.96.36.199".
But you want to keep the last bits and hash those that match the network mask?
Yes, I want to hash NID and HID separately. So I can identify IP belonging to same network after anonymization also.
Sounds like a reasonable feature request to the fingerprint plugin, but for now you'll probably have to use a ruby filter and write some custom code.