ipcrypt2

D bindings for IPCrypt2, a simple and secure IP address obfuscation scheme. + IPCrypt2 is a format-preserving encryption scheme for IPv4 and IPv6 addresses. It allows IP addresses to be encrypted while maintaining their format, making it suitable for logging and data retention purposes where IP addresses need to be pseudonymized. + Features: - Format-preserving encryption for both IPv4 and IPv6 addresses - Cryptographically secure using AES-128 as the underlying cipher - Preserves subnets: addresses sharing a prefix are encrypted to addresses sharing the same prefix - Deterministic: same input and key always produces the same output - Fast and constant-time operation

Public Imports

c.ipcrypt2c
public import c.ipcrypt2c;

IPCrypt2 C bindings

Members

Functions

ip16ToSockaddr
sockaddr_storage ip16ToSockaddr(const(ubyte)* ip16)

Converts a 16-byte IP address to a sockaddr_storage.

ip16ToStr
string ip16ToStr(const(ubyte)* ip16)

Converts a 16-byte IP address to a string.

ipStrToIP16
ubyte[IPCRYPT_KEYBYTES] ipStrToIP16(string ipStr)

Converts an IP address string to a 16-byte representation.

sockaddrToIP16
ubyte[IPCRYPT_KEYBYTES] sockaddrToIP16(sockaddr* sa)

Converts a sockaddr to a 16-byte IP address.

Structs

IPCrypt2
struct IPCrypt2

IPCrypt context, providing encryption/decryption of IP addresses. Ensures proper initialization and cleanup of the underlying IPCrypt context.

IPCryptNDXCtx
struct IPCryptNDXCtx

IPCryptNDX context, providing extended encryption/decryption. Ensures proper initialization and cleanup of the underlying IPCryptNDX context.

Meta