pub struct CryptoPan { /* private fields */ }Expand description
Crypto-PAn anonymizer backed by AES-128.
Implementations§
Source§impl CryptoPan
impl CryptoPan
Sourcepub fn new(key: &[u8; 32]) -> Self
pub fn new(key: &[u8; 32]) -> Self
Create a new Crypto-PAn instance from a 32-byte key.
key[0..16]is the AES-128 key.key[16..32]is the padding material.
Sourcepub fn anonymize_ipv4(&self, addr: Ipv4Addr) -> Ipv4Addr
pub fn anonymize_ipv4(&self, addr: Ipv4Addr) -> Ipv4Addr
Anonymize an IPv4 address (prefix-preserving).
Sourcepub fn anonymize_ipv6(&self, addr: Ipv6Addr) -> Ipv6Addr
pub fn anonymize_ipv6(&self, addr: Ipv6Addr) -> Ipv6Addr
Anonymize an IPv6 address (prefix-preserving).
Sourcepub fn anonymize_ip(&mut self, addr: IpAddr) -> IpAddr
pub fn anonymize_ip(&mut self, addr: IpAddr) -> IpAddr
Anonymize an IP address, using the cache for repeated lookups.
Sourcepub fn cache_size(&self) -> usize
pub fn cache_size(&self) -> usize
Number of cached address mappings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CryptoPan
impl RefUnwindSafe for CryptoPan
impl Send for CryptoPan
impl Sync for CryptoPan
impl Unpin for CryptoPan
impl UnsafeUnpin for CryptoPan
impl UnwindSafe for CryptoPan
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more