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 unsupported: 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 | 23914 | 68409 | 51758 | 24748 | 28210 | 95452 | 30420
| | lib25519+exp | 23917 | 67931 | 49930 | 24320 | 27837 | 95627 | 30638
| | lib25519+s2n+exp | 23565 | 68471 | 49924 | 24449 | 27792 | 94975 | 30663
| | lib25519+s2n | 24298 | 68204 | 51738 | 24538 | 27915 | 96525 | 30390
| | s2n-bignum | 24257 | 75395 | | | | | |
| Zen 3 (2020) | OpenSSL | 116119 | 112550 | | 118697 | 111383 | 371930 | |
| | lib25519 | 28685 | 96311 | 50504 | 28851 | 32440 | 127382 | 40617
| | lib25519+exp | 25741 | 72993 | 47762 | 26555 | 29973 | 113644 | 35889
| | lib25519+s2n+exp | 25615 | 73012 | 47731 | 26412 | 29922 | 114244 | 36038
| | lib25519+s2n | 28079 | 96085 | 71267 | 28913 | 32276 | 126871 | 40647
| | s2n-bignum | 26238 | 89699 | | | | | |
| Tiger Lake (2020) | OpenSSL | 113314 | 119132 | | 116048 | 111383 | 369181 | |
| | lib25519 | 28401 | 85953 | 62349 | 29251 | 32894 | 112179 | 35878
| | lib25519+exp | 26468 | 64705 | 21672 | 27395 | 31589 | 109090 | 32759
| | lib25519+s2n+exp | 26555 | 64620 | 21658 | 27424 | 31478 | 108282 | 33056
| | lib25519+s2n | 28186 | 85883 | 60803 | 28983 | 32853 | 114156 | 35329
| | s2n-bignum | 26474 | 83168 | | | | | |
| Zen 2 (2019) | OpenSSL | 127047 | 118791 | | 129676 | 121302 | 395245 | |
| | lib25519 | 27665 | 107760 | 74220 | 28473 | 31733 | 127604 | 37991
| | lib25519+exp | 27718 | 101005 | 73841 | 28568 | 31949 | 127591 | 38142
| | lib25519+s2n+exp | 26449 | 92446 | 74184 | 28539 | 32042 | 127768 | 38007
| | lib25519+s2n | 27647 | 108855 | 74127 | 28455 | 31751 | 127741 | 38208
| | s2n-bignum | 27058 | 92075 | | | | | |
| Ares (2019) | OpenSSL | 124704 | 469056 | | 210912 | 181248 | 630432 | |
| | lib25519 | 80796 | 246594 | 246302 | 81672 | 85248 | 286386 | 82363
| | lib25519+exp | 80640 | 246024 | 246783 | 81534 | 85158 | 284712 | 82282
| | lib25519+s2n+exp | 43410 | 95616 | 96381 | 81408 | 85620 | 283638 | 82711
| | lib25519+s2n | 43386 | 95616 | 95594 | 81450 | 85596 | 283896 | 82608
| | s2n-bignum | 115392 | 254976 | | | | | |
| Goldmont (2016) | OpenSSL | 247078 | 273628 | | 258924 | 228182 | 753852 | |
| | lib25519 | 93798 | 281771 | 284141 | 96345 | 106290 | 340904 | 96753
| | lib25519+exp | 93581 | 281769 | 285958 | 96064 | 106090 | 335658 | 95987
| | lib25519+s2n+exp | 76428 | 255309 | 262507 | 95938 | 106071 | 340408 | 96728
| | lib25519+s2n | 76448 | 255298 | 256944 | 96410 | 105941 | 342036 | 97016
| | s2n-bignum | 77436 | 255312 | | | | | |
| Cortex-A72 (2016) | OpenSSL | 156925 | 424557 | | 163459 | 134998 | 425152 | |
| | lib25519 | 106181 | 329823 | 331034 | 108075 | 115362 | 391903 | 116174
| | lib25519+exp | 106339 | 329820 | 330725 | 108134 | 115296 | 388337 | 117125
| | lib25519+s2n+exp | 66728 | 136513 | 136679 | 109065 | 116737 | 392035 | 115822
| | lib25519+s2n | 66998 | 136513 | 136634 | 109568 | 115893 | 387046 | 116484
| | s2n-bignum | 67271 | 136516 | | | | | |
| Skylake (2015) | OpenSSL | 130113 | 118411 | | 133656 | 125076 | 410342 | |
| | lib25519 | 29692 | 87876 | 63356 | 30487 | 34178 | 115932 | 37897
| | lib25519+exp | 27768 | 82617 | 62859 | 28591 | 32066 | 102912 | 34192
| | lib25519+s2n+exp | 27720 | 82538 | 62349 | 28548 | 31974 | 103861 | 33864
| | lib25519+s2n | 29632 | 91320 | 63021 | 30519 | 34153 | 116812 | 37771
| | s2n-bignum | 28806 | 84561 | | | | | |
| Airmont (2015) | OpenSSL | 294239 | 619002 | | 307282 | 276812 | 853664 | |
| | lib25519 | 143354 | 449531 | 453233 | 147006 | 162360 | 538729 | 155831
| | lib25519+exp | 143469 | 449526 | 449664 | 147268 | 162544 | 545049 | 155471
| | lib25519+s2n+exp | 115796 | 432250 | 432474 | 147040 | 162443 | 540996 | 155551
| | lib25519+s2n | 115310 | 431887 | 432423 | 147519 | 162521 | 534689 | 154865
| | s2n-bignum | 116864 | 432414 | | | | | |
| Broadwell (2014) | OpenSSL | 160005 | 121255 | | 164427 | 120150 | 392515 | |
| | lib25519 | 32283 | 98703 | 76275 | 32446 | 35978 | 122367 | 40335
| | lib25519+exp | 29087 | 84887 | 72019 | 29798 | 33519 | 108336 | 34087
| | lib25519+s2n+exp | 29072 | 85183 | 72074 | 29924 | 33656 | 108075 | 34176
| | lib25519+s2n | 31999 | 93402 | 75268 | 32349 | 35995 | 123093 | 39784
| | s2n-bignum | 31396 | 87934 | | | | | |
| Haswell (2013) | OpenSSL | 129719 | 163429 | | 133869 | 126120 | 409113 | |
| | lib25519 | 43651 | 118295 | 78589 | 44625 | 48554 | 152655 | 50027
| | lib25519+exp | 41529 | 115343 | 76711 | 42391 | 46307 | 152299 | 51095
| | lib25519+s2n+exp | 41622 | 115321 | 76639 | 42549 | 46292 | 152021 | 51281
| | lib25519+s2n | 43725 | 118643 | 78694 | 44474 | 48505 | 154119 | 50258
| | s2n-bignum | 45860 | 160318 | | | | | |
| Cortex-A53 (2012) | OpenSSL | 220649 | 513705 | | 228344 | 194443 | 537285 | |
| | lib25519 | 150257 | 464193 | 462874 | 152356 | 161604 | 514499 | 154920
| | lib25519+exp | 149390 | 464490 | 463997 | 152091 | 161371 | 517547 | 153988
| | lib25519+s2n+exp | 116303 | 163712 | 164737 | 151835 | 161198 | 518829 | 155405
| | lib25519+s2n | 116449 | 163004 | 164667 | 151644 | 161403 | 516001 | 155364
| | s2n-bignum | 120158 | 163155 | | | | | |
| Core 2 (2006) | OpenSSL | 260681 | 337177 | | 267882 | 241408 | 741945 | |
| | lib25519 | 93286 | 300023 | 299458 | 96897 | 105719 | 350100 | 102180
| | lib25519+exp | 93748 | 300631 | 299729 | 97339 | 106421 | 353709 | 102230
| | lib25519+s2n+exp | 70996 | 262775 | 262533 | 97322 | 106036 | 355995 | 103031
| | lib25519+s2n | 71073 | 262945 | 262594 | 96803 | 105512 | 346167 | 102056
| | 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_.