Add IPCrypt support in Sodium extension

Đang mở
#25,242 1 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, php
Lĩnh vực
backend, cryptography

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
C
Star
41.8k
Fork
8.5k
Merge trung bình
2 ngày 12 giờ
Pull request đã merge (30 ngày)
137

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của php/php-src

Tất cả issue của php/php-src

Issue tương tự

Thêm issue về C

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.