Slower is better, as slow as you can tolerate. Timing for different -a
values, each measured 20 times:
-a 16 takes on average 0.247 (seconds)
-a 32 takes on average 0.586
-a 64 takes on average 1.206
-a 100 takes on average 1.962
-a 150 takes on average 2.664
The time is linear, so you can expect a doubling of the -a
value to take twice as long. The default (16) takes about a quarter of a second on a reasonable i5 CPU in 2018 (and CPUs aren't doing anything close to doubling in operations per second per buck every 18 months anymore).
Measurement method
This is measured by changing the password on a key (because that doesn't wait for /dev/random
):
time ssh-keygen -qa 16 -N newpassword -pP oldpassword -f keyfile
To create the overview, I used this code (running the command 20 times for each -a
value):
$ for j in 16 32 64 100 150; do
> echo -n "-a $j takes on average";
> 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 |& grep real | awk -F m '{print $2}' | tr -d s | awk '{sum+=$1} END{print sum/NR}';
> done
The time is less stable than I would expect, probably due to CPU throttling (my laptop throttles ridiculously when it goes over 40°C, which is a bug). Still, these look a lot more stable and sensible than the numbers in ZzAntáres' answer. Here are raw values for 10 runs of each rounds setting:
16 0.243 0.243 0.242 0.242 0.242 0.242 0.244 0.263 0.250 0.257
32 0.482 0.482 0.483 0.486 0.537 0.481 0.481 0.481 0.481 0.991
64 1.064 0.962 0.959 0.996 0.959 0.959 0.959 1.548 0.959 0.976
100 1.798 1.514 2.109 1.609 1.496 1.496 1.498 1.496 1.497 1.496
150 2.659 3.373 3.373 2.726 2.301 2.473 3.373 3.374 2.893 2.242
for x in {1..5};do /usr/bin/time ssh user@IP exit;done
and scp withfor x in {1..5};do /usr/bin/time scp test1MiB.img user@IP:/home/user/; done
(repeated with te $\endgroup$-o
is redundant with-t ed25519
. Notice last sentence of “man” page in macOS High Sierra: ssh-keygen-o
Causes ssh-keygen to save private keys using the new OpenSSH for- mat rather than the more compatible PEM format. The new format has increased resistance to brute-force password cracking but is not supported by versions of OpenSSH prior to 6.5. Ed25519 keys always use the new private key format. $\endgroup$