Crate ipcrypt [] [src]

ipcrypt was designed by Jean-Philippe Aumasson to encrypt IPv4 addresses with 16-byte keys, where the result is still an IPv4 address.

Derived from the implementation at: https://github.com/veorq/ipcrypt

As input and output this implementation takes various types representing a sequence of 4 bytes. u32 is interpreted as big endian (network order; for consistency with how IPv4 adresses are represented as u32).

This crate supports a no-std feature which removes support for Ipv4Addr (because it's not available in core).

Example

use std::net::Ipv4Addr;
let addr = "127.0.0.1".parse::<Ipv4Addr>().unwrap();
println!("{}", ipcrypt::encrypt(addr, b"some 16-byte key"));

Structs

State

The inner state permutations are build on. Input and Output types are converted to an from this type.

Functions

decrypt

Decrypt value with given key.

encrypt

Encrypt value with given key.

Type Definitions

Key

Alias for the key type (16 bytes)