You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a dual stack machine a typical log file contains ipv4 and ipv6 addresses. Anonymizing with the algorithm "IPV4_NETWORK" will work as Ruby's IPAddr works with ipv4 and ipv6 adressess, but the result is not useful (with a key "24" 193.99.144.85 will become 193.99.144.0 (good) and 2a02:2e0:3fe:1001:7777:772e:2:85 will become 2a02:200:: (useless)).
A solution would be a new algorithm (called e.g. IP_NETWORK) using different prefix lengths for IPv4 and IPv6.
This could be done like
defanonymize_ip_network(ip_string)# in JRuby 1.7.11 outputs as US-ASCIIaddr=IPAddr.new(ip_string)ifaddr.ipv4?addr.mask(@key.split(':')[0].to_i).to_s.force_encoding(Encoding::UTF_8)elseaddr.mask(@key.split(':')[1].to_i).to_s.force_encoding(Encoding::UTF_8)endend
expecting a key in the format "v4prefix:v6prefix" or
defanonymize_ip_network(ip_string)# in JRuby 1.7.11 outputs as US-ASCIIaddr=IPAddr.new(ip_string)ifaddr.ipv4?addr.mask(@prefix_length[0]).to_s.force_encoding(Encoding::UTF_8)elseaddr.mask(@prefix_length[1]).to_s.force_encoding(Encoding::UTF_8)endend
with a new array parameter prefix_length.
The text was updated successfully, but these errors were encountered:
On a dual stack machine a typical log file contains ipv4 and ipv6 addresses. Anonymizing with the algorithm "IPV4_NETWORK" will work as Ruby's
IPAddr
works with ipv4 and ipv6 adressess, but the result is not useful (with a key "24"193.99.144.85
will become193.99.144.0
(good) and2a02:2e0:3fe:1001:7777:772e:2:85
will become2a02:200::
(useless)).A solution would be a new algorithm (called e.g.
IP_NETWORK
) using different prefix lengths for IPv4 and IPv6.This could be done like
expecting a key in the format
"v4prefix:v6prefix"
orwith a new array parameter prefix_length.
The text was updated successfully, but these errors were encountered: