Add IPCrypt support in Sodium extension

Ouverte
#25,242 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
5/5
Temps estimé
Plus d'une semaine
Accessibilité débutants
35/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
c, php

Piste de recherche

Start by reading PHP's Sodium extension and the linked libsodium IPCrypt documentation to understand how the requested functions map to the library API. The issue lists the constants and functions to add, but does not identify source files or tests; locate those entry points and existing Sodium tests first. Done means the listed IPCrypt constants and functions are exposed with behavior matching libsodium.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Feature Status: Needs Triage
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:

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
Langage dominant
C
Étoiles
41.8k
Forks
8.5k
Merge moyen
2 j 12 h
PR mergées (30 j)
137

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de php/php-src

Toutes les issues de php/php-src

Issues similaires

Plus d'issues C

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.