Benchmarks
You can easily check if an algorithm is fast enough on your platform. This project has tests for all operations with (almost) all algorithms.
All algorithms
To run those tests, you must install the library with all dev dependencies. When done, just run the following command:
./vendor/bin/phpbench run --storeThe previous command will test ALL algorithms and may take more than 7 hours.
Algorithm Selection
We recommend you to run tests only for the algorithm(s) you want to use. Just run the following command:
./vendor/bin/phpbench run --group GROUP --storeThe value of GROUP should be one of the following values:
All signature algorithms:
JWSAll HMAC algorithms:
hmacHS256:
HS256HS384:
HS384HS512:
HS512
All Elliptic Curves algorithms:
ECDSAES256:
ES256ES384:
ES384ES512:
ES512
All Edwards-curve algorithms:
EdDSAEd25519:
Ed25519
All RSA algorithms:
RSASignRS256:
RS256RS384:
RS384RS512:
RS512PS256:
PS256PS384:
PS384PS512:
PS512
All key encryption algorithms:
JWEKWA128KW:
A128KWA192KW:
A192KWA256KW:
A256KW
GCMKWA128GCMKW:
A128GCMKWA192GCMKW:
A192GCMKWA256GCMKW:
A256GCMKW
ECDHESECDH-ES:
ECDHESECDHESKWECDHESA128KW:
ECDH-ES+A128KWECDHESA192KW:
ECDH-ES+A192KWECDHESA256KW:
ECDH-ES+A256KW
PBES2PBES2-HS256+A128KW:
PBES2HS256A128KWPBES2-HS384+A192KW:
PBES2HS384A192KWPBES2-HS512+A256KW:
PBES2HS512A256KW
RSAEncRSA1_5:
RSA1_5RSA-OAEP:
RSA-OAEPRSA-OAEP-256:
RSA-OAEP-256
Note 1: the
diralgorithm is not tested as there is no key encryption or key decryption with this algorithm.Note 2: tests consist in a full JWS/JWE creation and loading and sometimes using multiple key sizes.
Note 3: for JWE creation and loading, each key encryption algorithm is tested with the following content encryption algorithms:
A128GCM,A192GCMandA256GCMA128CBC-HS256,A192CBC-HS384andA256CBC-HS512
Examples
Test all HMAC algorithms:
Test the RSA1_5 algorithm:
Benchmark Details
The result of the following command will only give you partial result. For example:
The main information is that the best algorithm takes only 31.275 µs... but you may need more information.
Just run the following command:
*The value of the --uuid option is given at the end of the previous command. You can also use latest.
A report.md file will be created. It contains a detailed report (Markdown format). Example:
If it is not enough for you, you can get a full report with the following command:
Last updated
Was this helpful?