Download the PHP package jedisct1/ipcrypt without Composer
On this page you can find all versions of the php package jedisct1/ipcrypt. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package ipcrypt
IPcrypt PHP Implementation
This is a PHP implementation of IPcrypt, which provides methods for encrypting and decrypting IP addresses. The implementation follows the IPcrypt specification and provides three different encryption modes.
Features
- Deterministic encryption (using AES-128)
- Non-deterministic encryption (using KIASU-BC)
- XEX-mode encryption (using AES-XTS)
- Support for both IPv4 and IPv6 addresses (with IPv4-mapped IPv6 handling)
- Secure key generation for all modes
- Comprehensive test suite with test vectors from the specification
- PSR-12 compliant code style
- Extensive test coverage for core functionality
Requirements
- PHP 8.2 or higher
- OpenSSL extension (for AES operations)
- Composer (for installation and development)
Installation
Usage
Deterministic Encryption (ipcrypt-deterministic)
Uses AES-128 to provide deterministic encryption. The same input will always produce the same output when using the same key.
Non-deterministic Encryption (ipcrypt-nd)
Uses KIASU-BC to provide non-deterministic encryption. Each encryption operation uses a random tweak value to produce different ciphertexts for the same input.
XTS-mode Encryption (ipcrypt-ndx)
Uses AES-XTS mode to provide non-deterministic encryption with enhanced security properties. Requires a 32-byte key (two AES-128 keys).
Development
Running Tests
The project includes a comprehensive test suite with test vectors from the IPcrypt specification:
Current test status: ✅ 60 tests, 137 assertions - all passing
Examples
Complete working examples can be found in the examples/
directory.
Code Style
The code follows PSR-12 coding standards. To check and fix code style:
Type Safety
The codebase uses PHP 8.2+ type hints throughout:
- Parameter and return type declarations
- Property type declarations
- Strict type checking enabled
- Comprehensive PHPDoc blocks with type information
Implementation Details
IP Address Handling
- IPv4 addresses are converted to IPv4-mapped IPv6 addresses internally
- All operations work on 16-byte blocks (IPv6 address size)
- Automatic detection and conversion between IPv4 and IPv6 formats
Security Features
- Built-in secure key generation for each mode
- Secure random number generation for tweaks
- No padding required (fixed-size inputs)
- Constant-time operations where possible
- Input validation for all parameters
- Regular security scans via GitHub Actions
Key Generation
Each implementation provides a secure key generation method:
IpcryptDeterministic::generateKey()
: Generates a 16-byte key for AES-128IpcryptNd::generateKey()
: Generates a 16-byte key for KIASU-BCIpcryptNdx::generateKey()
: Generates a 32-byte key (two AES-128 keys) for XTS mode
Continuous Integration
The project uses GitHub Actions for:
- Automated testing on various PHP versions
- Code style checking (PSR-12)
- Security vulnerability scanning
- Test coverage reporting
License
MIT License. See LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
All versions of ipcrypt with dependencies
ext-openssl Version *