### Description libsodium exposes IPCrypt features since version 1.0.21 (January 6, 2026): https://libsodium.gitbook.io/doc/secret-key_cryptography/ip_address_encryption There is IPCrypt userspace implementation for PHP: https://github.com/jedisct1/php-ipcrypt But since we are shipping sodium in PHP, it would be nice to also natively have the sodium IPCrypt functions in PHP. This would mean adding the following constants and functions: ```php const SODIUM_CRYPTO_IPCRYPT_NDX_TWEAKBYTES; // Utils sodium_ip2bin(string $ip): string sodium_bin2ip(string $binary): string // Deterministic sodium_crypto_ipcrypt_keygen(): string sodium_crypto_ipcrypt_encrypt(string $binary_ip, string $key): string sodium_crypto_ipcrypt_decrypt(string $binary_encrypted_ip, string $key): string // Non-deterministic (ND) sodium_crypto_ipcrypt_nd_keygen(): string sodium_crypto_ipcrypt_nd_encrypt(string $binary_ip, string $key): string sodium_crypto_ipcrypt_nd_decrypt(string $binary_encrypted_ip, string $key): string // Prefix-preserving encryption (PFX) sodium_crypto_ipcrypt_pfx_keygen(): string sodium_crypto_ipcrypt_pfx_encrypt(string $binary_ip, string $key): string sodium_crypto_ipcrypt_pfx_decrypt(string $binary_encrypted_ip, string $key): string // Extended non-deterministic encryption (NDX) sodium_crypto_ipcrypt_ndx_keygen(): string sodium_crypto_ipcrypt_ndx_encrypt(string $binary_ip, string $key, string $tweak): string sodium_crypto_ipcrypt_ndx_decrypt(string $binary_encrypted_ip, string $key): string ```
Activity
rafamolina1 commentedon Nov 6, 2026
Im on it