In the world of digital signatures, Ed25519 stands out for its security and speed. However, for high-throughput PHP applications, performance is paramount. The Codernix ED25519 PHP Extension was born from the need to push the boundaries of signature verification speed within the PHP ecosystem.
Our extension provides a direct bridge to one of the fastest Ed25519 implementations available: a highly optimized assembly version from the SUPERCOP crypto bundle, now made accessible and safe for use as a modern PHP module.
The Challenge: Modernizing a Legacy Build Process
SUPERCOP is a powerful toolkit for benchmarking cryptography, but it was never designed for creating simple, standalone libraries. Our effort faced two significant hurdles:
- Breaking Free from Complex Build Scripts: The standard SUPERCOP process relies on a
do-part
script that is slow and cumbersome. It benchmarks numerous implementations with various compilers, a process that takes a very long time and only produces static archives (.a
files), which are unsuitable for a portable PHP extension. At Codernix Solutions, we engineered a custom build script that bypasses this entirely. Our script targets only the specific assembly implementation we need, preprocesses the files, and generates both static and shared (.so
) libraries in record time. - Adapting Assembly for Shared Libraries: Raw assembly code offers unparalleled performance but often lacks the portability required for modern shared libraries. The original SUPERCOP implementation, while incredibly fast, was not designed to be position-independent, meaning it couldn’t be safely loaded as a dynamic module by the PHP engine. Our key contribution was adapting the original assembly code to be fully position-independent (PIC), a necessary and complex step to create a stable and portable shared library for PHP.
This combined effort ensures that you get the raw speed of assembly without the slow, complex build process, all while maintaining the stability and security required for production environments.
Core Features
- Extreme Performance: Directly leverages the
amd64-64-24k
assembly implementation from SUPERCOP for best-in-class signature verification speed on x86-64 architectures. - Modern & Secure: Provides the full Ed25519 feature set (key generation, signing, and verification) based on one of the most trusted algorithms in modern cryptography.
- Simple PHP API: Offers a clean and intuitive set of functions (
ed25519_keypair
,ed25519_sign
,ed25519_open
) that are easy to integrate into any project.
The Power of Batch Verification
For applications that need to validate hundreds or thousands of signatures per second—such as API gateways, blockchain nodes, or distributed systems—verifying signatures one by one is a major bottleneck.
Our extension’s most powerful feature is ed25519_open_batch()
. This function allows you to verify a large number of signatures in a single, highly optimized operation. By processing signatures as a batch, it dramatically reduces the overhead of function calls and leverages CPU caches more efficiently, resulting in a massive performance increase over sequential verification.
// Example: Verifying a batch of signatures
$results = ed25519_open_batch($arrayOfSignedMessages, $arrayOfPublicKeys);
// $results is an array of messages or `false` for invalid signatures.
Get Started
The Codernix ED25519 PHP Extension is open source and available for immediate use. Dive into the code, review our implementation, and integrate high-speed signature verification into your application today.