Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Created May 31, 2023 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mttjohnson/e89cd6fac80d65a62454e1ee9681c247 to your computer and use it in GitHub Desktop.
Save mttjohnson/e89cd6fac80d65a62454e1ee9681c247 to your computer and use it in GitHub Desktop.
Testing SSH Keygen (rounds of key derivations)
#!/usr/bin/env bash
set -eu
## shellcheck ./keygentest.sh
for j in 16 32 64 100 150 256; do
echo -n "-a $j takes on average ";
# shellcheck disable=SC2034
for i in {1..20}; do
ssh-keygen -qa $j -t ed25519 -f test -N test;
time ssh-keygen -qa $j -N tost -pP test -f test;
rm test{.pub,};
done 2>&1 | grep real | awk -F m '{print $2}' | sed 's/,/./;s/s//' | LC_ALL=C awk '{sum+=$1} END{print sum/NR}';
done

Testing SSH Keygen (rounds of key derivations) to slow down passphrase verification and increase resistance to brute-force password cracking. The default is 16 rounds.

ed25519 - Apple MacBook Pro 2012 (Legacy Intel(R) Core(TM) i5-3210M)

-a 16 takes on average 0.36155
-a 32 takes on average 0.70905
-a 64 takes on average 1.43805
-a 100 takes on average 2.17795
-a 150 takes on average 3.25105
-a 256 takes on average 5.6617

ed25519 - GCP CE t2d-standard-1 - Ubuntu Pro 20.04 LTS / FIPS Mode (AMD EPYC 7B13)

-a 16 takes on average 0.25415
-a 32 takes on average 0.4915
-a 64 takes on average 0.96715
-a 100 takes on average 1.50855
-a 150 takes on average 2.24455
-a 256 takes on average 3.8302

ed25519 - Apple MacBook Pro 2021 (Apple M1 Pro - 10 Core)

-a 16 takes on average 0.22655
-a 32 takes on average 0.4474
-a 64 takes on average 0.88965
-a 100 takes on average 1.38955
-a 150 takes on average 2.0816
-a 256 takes on average 3.54645

ed25519 - Lenovo ThinkStation P-360 Tiny - Ubuntu 22.04 LTS (12th Gen Intel(R) Core(TM) i7-12700T)

-a 16 takes on average 0.1749
-a 32 takes on average 0.3485
-a 64 takes on average 0.69165
-a 100 takes on average 1.08
-a 150 takes on average 1.62095
-a 256 takes on average 2.7616
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment