In the following speed table, smaller numbers are better.
The numbers are median single-core cycle counts on various microarchitectures.
Overclocking is disabled.
The table reports cycle counts from lib25519 and, for comparison,
OpenSSL and s2n-bignum.
For comparability to OpenSSL's speed-testing utility,
the OpenSSL cycle counts omit various OpenSSL overheads; see below for details.
The s2n-bignum and lib25519 cycle counts include all overheads.
There is also a lib25519+s2n line showing separate measurements of lib25519
after an optional pre-configuration `./use-s2n-bignum` step
(which is a supported option for lib25519);
a lib25519+exp line showing separate measurements of lib25519
after an experimental pre-configuration `mv skipcompilers/* compilers` step
(which is not supported because it uses instructions not supported by `valgrind`);
and a lib25519+s2n+exp line.
| μarch | software | X key | X dh | X batch | Ed key | Ed sign | Ed verif | Ed MSM |
| :---- | :------- | ----: | ---: | ------: | -----: | ------: | -------: | -----: |
| Golden Cove (2021) | OpenSSL | 99570 | 103325 | | 101362 | 96222 | 320673 | |
| | lib25519 | 23782 | 68511 | 51744 | 24757 | 28039 | 96607 | 30088
| | lib25519+exp | 25266 | 68304 | 49799 | 24745 | 28676 | 93508 | 30620
| | lib25519+s2n+exp | 24740 | 67850 | 49945 | 24800 | 28794 | 95780 | 30223
| | lib25519+s2n | 24290 | 68063 | 51735 | 25286 | 28948 | 94614 | 30367
| | s2n-bignum | 24257 | 75395 | | | | | |
| Zen 3 (2020) | OpenSSL | 116119 | 112550 | | 118697 | 111383 | 371930 | |
| | lib25519 | 28212 | 96632 | 71142 | 29031 | 32497 | 128179 | 40784
| | lib25519+exp | 25626 | 73060 | 47915 | 26407 | 29771 | 113420 | 35826
| | lib25519+s2n+exp | 25718 | 73005 | 48216 | 26376 | 29771 | 112841 | 35657
| | lib25519+s2n | 28378 | 96214 | 50510 | 29241 | 32596 | 129089 | 40643
| | s2n-bignum | 26238 | 89699 | | | | | |
| Tiger Lake (2020) | OpenSSL | 113314 | 119132 | | 116048 | 111383 | 369181 | |
| | lib25519 | 28303 | 86103 | 61087 | 29193 | 32873 | 114671 | 35021
| | lib25519+exp | 26534 | 64591 | 21647 | 27423 | 31078 | 107330 | 32849
| | lib25519+s2n+exp | 26582 | 64634 | 21657 | 27419 | 31072 | 107951 | 32682
| | lib25519+s2n | 28499 | 86021 | 62111 | 29107 | 32774 | 111938 | 35388
| | s2n-bignum | 26474 | 83168 | | | | | |
| Zen 2 (2019) | OpenSSL | 127047 | 118791 | | 129676 | 121302 | 395245 | |
| | lib25519 | 27664 | 109306 | 74116 | 28683 | 31853 | 128656 | 38028
| | lib25519+exp | 27645 | 101031 | 73809 | 28456 | 31584 | 129403 | 37934
| | lib25519+s2n+exp | 27592 | 93340 | 73833 | 28334 | 31676 | 127228 | 38191
| | lib25519+s2n | 27624 | 109307 | 74457 | 28410 | 31608 | 128845 | 38363
| | s2n-bignum | 27058 | 92075 | | | | | |
| Ares (2019) | OpenSSL | 124704 | 469056 | | 210912 | 181248 | 630432 | |
| | lib25519 | 80550 | 246336 | 248292 | 81600 | 85572 | 285540 | 82479
| | lib25519+exp | 80526 | 245454 | 272732 | 81456 | 85506 | 280002 | 81794
| | lib25519+s2n+exp | 80418 | 95616 | 95627 | 81432 | 85956 | 281484 | 82900
| | lib25519+s2n | 80688 | 95616 | 95670 | 81240 | 85902 | 282276 | 82598
| | s2n-bignum | 115392 | 254976 | | | | | |
| Goldmont (2016) | OpenSSL | 247078 | 273628 | | 258924 | 228182 | 753852 | |
| | lib25519 | 93747 | 281776 | 295259 | 96235 | 106167 | 338370 | 96798
| | lib25519+exp | 93640 | 282472 | 282975 | 96694 | 106438 | 347507 | 97205
| | lib25519+s2n+exp | 93581 | 255341 | 258170 | 96235 | 106085 | 343949 | 97197
| | lib25519+s2n | 93623 | 255308 | 257031 | 96114 | 106224 | 341928 | 96369
| | s2n-bignum | 77436 | 255312 | | | | | |
| Cortex-A72 (2016) | OpenSSL | 156925 | 424557 | | 163459 | 134998 | 425152 | |
| | lib25519 | 106344 | 330111 | 330312 | 107879 | 114955 | 389349 | 116928
| | lib25519+exp | 106307 | 329851 | 330943 | 107802 | 114915 | 384273 | 116616
| | lib25519+s2n+exp | 107041 | 136513 | 136610 | 108536 | 115674 | 389278 | 116234
| | lib25519+s2n | 107376 | 136513 | 136653 | 108857 | 116103 | 389088 | 117090
| | s2n-bignum | 67271 | 136516 | | | | | |
| Skylake (2015) | OpenSSL | 130113 | 118411 | | 133656 | 125076 | 410342 | |
| | lib25519 | 29774 | 87971 | 62755 | 30550 | 34193 | 116991 | 38727
| | lib25519+exp | 27729 | 83396 | 62311 | 28469 | 32212 | 104229 | 34226
| | lib25519+s2n+exp | 27835 | 83311 | 62409 | 28581 | 32040 | 105749 | 33645
| | lib25519+s2n | 29692 | 88037 | 62758 | 30465 | 34140 | 115452 | 38353
| | s2n-bignum | 28806 | 84561 | | | | | |
| Airmont (2015) | OpenSSL | 294239 | 619002 | | 307282 | 276812 | 853664 | |
| | lib25519 | 143556 | 449573 | 449669 | 147077 | 162570 | 542220 | 155193
| | lib25519+exp | 143690 | 449577 | 449759 | 147559 | 163466 | 543578 | 157011
| | lib25519+s2n+exp | 143577 | 431947 | 432389 | 147515 | 163011 | 535507 | 154742
| | lib25519+s2n | 143574 | 432101 | 432428 | 147600 | 163312 | 548012 | 154217
| | s2n-bignum | 116864 | 432414 | | | | | |
| Broadwell (2014) | OpenSSL | 160005 | 121255 | | 164427 | 120150 | 392515 | |
| | lib25519 | 31489 | 93339 | 75648 | 33817 | 36660 | 121583 | 41126
| | lib25519+exp | 29045 | 84991 | 73245 | 29855 | 33706 | 107476 | 34567
| | lib25519+s2n+exp | 28952 | 84915 | 72056 | 29741 | 34362 | 107526 | 33849
| | lib25519+s2n | 31826 | 95068 | 74803 | 32255 | 35937 | 126280 | 40088
| | s2n-bignum | 31396 | 87934 | | | | | |
| Haswell (2013) | OpenSSL | 129719 | 163429 | | 133869 | 126120 | 409113 | |
| | lib25519 | 43627 | 118326 | 78662 | 44597 | 48406 | 153211 | 49929
| | lib25519+exp | 41369 | 115219 | 77087 | 42490 | 46522 | 153486 | 51755
| | lib25519+s2n+exp | 41567 | 115115 | 76679 | 42414 | 46467 | 150762 | 51108
| | lib25519+s2n | 43637 | 118327 | 78579 | 44500 | 48368 | 151548 | 50688
| | s2n-bignum | 45860 | 160318 | | | | | |
| Cortex-A53 (2012) | OpenSSL | 220649 | 513705 | | 228344 | 194443 | 537285 | |
| | lib25519 | 149030 | 463869 | 464098 | 151808 | 160892 | 520120 | 154072
| | lib25519+exp | 149449 | 464134 | 464208 | 152091 | 161586 | 517634 | 153442
| | lib25519+s2n+exp | 149814 | 163680 | 164640 | 151726 | 160924 | 523501 | 154787
| | lib25519+s2n | 149992 | 163661 | 164625 | 151849 | 160395 | 514915 | 154407
| | s2n-bignum | 120158 | 163155 | | | | | |
| Core 2 (2006) | OpenSSL | 260681 | 337177 | | 267882 | 241408 | 741945 | |
| | lib25519 | 93212 | 298639 | 304039 | 96710 | 106278 | 354754 | 102007
| | lib25519+exp | 93670 | 298781 | 299398 | 97202 | 106574 | 355622 | 102093
| | lib25519+s2n+exp | 93628 | 262775 | 262519 | 96884 | 106284 | 354495 | 102237
| | lib25519+s2n | 93270 | 262946 | 262832 | 96706 | 106564 | 349492 | 103118
| | s2n-bignum | 78529 | 262932 | | | | | |
Microarchitectures are listed in reverse chronological order of when they were introduced.
Each library is assigned one foreground color in the table.
In the lib25519 distribution,
`command/lib25519-speed.c` measures lib25519;
`benchmarks/*-*` is the output of `lib25519-speed` on various machines;
`speedcomparison/openssl/*` has code to measure OpenSSL, and measurements from various machines;
`speedcomparison/s2n/*` has code to measure s2n-bignum, and measurements from various machines;
and `autogen/md-speed` extracts the table from those measurements.
OpenSSL benchmarks use version 3.3.2 (2024.09.03);
s2n-bignum benchmarks use commit acbb18e6343f12a7944de72c1ec0991739600f8c (2024.03.18).
The table reports only median cycle counts;
see the full output files
for differences between multiple measurements and the median.
The table reports the following major operations:
* "X key": Generating an X25519 public key and secret key.
This is `dh_x25519_keypair selected 32` in the `lib25519-speed` output
(`lib25519_dh_keypair` in the stable API).
For s2n-bignum,
this is `x25519-keygen` in the `s2n25519speed` output,
measuring the cost of `curve25519_x25519base_byte_alt`,
or `curve25519_x25519base_byte` on machines where that works and is faster.
For OpenSSL,
this is `x25519-keygen-main` in the `openssl25519speed` output,
measuring the cost of `EVP_PKEY_Q_keygen(0,0,"X25519")`.
This does not include small OpenSSL overheads for converting the public key and secret key to storage format.
* "X dh":
Generating an X25519 shared secret.
This is `dh_x25519 selected 32` in the `lib25519-speed` output
(`lib25519_dh` in the stable API).
For s2n-bignum,
this is `x25519-dh` in the `s2n25519speed` output,
measuring the cost of `curve25519_x25519_byte_alt`,
or `curve25519_x25519_byte` on machines where that works and is faster.
For OpenSSL,
this is `x25519-dh-main` in the `openssl25519speed` output,
measuring the cost of `EVP_PKEY_derive`
(as in OpenSSL's speed-testing utility).
This does not include the cost of `EVP_PKEY_new_raw_public_key`
to decode the public key (`x25519-dh-pkdecode`, 6836 cycles on Tiger Lake),
`EVP_PKEY_CTX_new` and `EVP_PKEY_derive_init` and `EVP_PKEY_derive_set_peer` for initialization
(together `x25519-dh-init`, 2423 cycles on Tiger Lake),
and
`EVP_PKEY_new_raw_private_key` to decode the secret key if it is not decoded already
(`x25519-dh-skdecode`, 112114 cycles on Tiger Lake).
* "X batch":
Cost _per secret_ of generating 16 separate shared secrets.
This is `nPbatch_montgomery25519 selected 16` in the `lib25519-speed` output _divided by 16_.
* "Ed key": Generating an Ed25519 public key and secret key.
This is `sign_ed25519_keypair selected 32` in the `lib25519-speed` output
(`lib25519_sign_keypair` in the stable API).
For OpenSSL,
this is `ed25519-keygen-main` in the `openssl25519speed` output,
measuring the cost of `EVP_PKEY_Q_keygen(0,0,"ED25519")`.
This does not include small OpenSSL overheads for converting the public key and secret key to storage format.
* "Ed sign": Generating an Ed25519 signature of a 59-byte message.
This is `sign_ed25519 selected 59` in the `lib25519-speed` output
(`lib25519_sign` in the stable API).
For OpenSSL,
this is `ed25519-sign-main` in the `openssl25519speed` output,
measuring the cost of `EVP_DigestSign`
(as in OpenSSL's speed-testing utility).
This does not include the cost of
`EVP_MD_CTX_new` and
`EVP_DigestSignInit`
(`ed25519-sign-init`, 2808 cycles on Tiger Lake),
and `EVP_PKEY_new_raw_private_key` to decode the secret key if it is not decoded already
(`ed25519-sign-skdecode`, 114894 cycles on Tiger Lake).
* "Ed verif": Verifying an Ed25519 signature and recovering a 59-byte message.
This is `sign_ed25519_open selected 59` in the `lib25519-speed` output
(`lib25519_sign_open` in the stable API).
For OpenSSL,
this is `ed25519-verify-main` in the `openssl25519speed` output,
measuring the cost of `EVP_DigestVerify`
(as in OpenSSL's speed-testing utility).
This does not include the cost of
`EVP_MD_CTX_new` and
`EVP_DigestVerifyInit`
(together `ed25519-verify-init`, 2579 cycles on Tiger Lake),
and `EVP_PKEY_new_raw_public_key`
to decode the public key being used for verification
(`ed25519-verify-pkdecode`, 7401 cycles on Tiger Lake).
* "Ed MSM": Cost _per point_ of multi-scalar multiplication with 16 points and 16 full-size scalars.
This is `multiscalar_ed25519 selected 16` in the `lib25519-speed` output _divided by 16_.