Skip to content

Instantly share code, notes, and snippets.

@jvhaarst
Created September 1, 2013 13:32
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 jvhaarst/6404493 to your computer and use it in GitHub Desktop.
Save jvhaarst/6404493 to your computer and use it in GitHub Desktop.
Small script to test the different SSH cipher speeds, by copying a file through an SSH connection to localhost to /dev/null
#!/bin/bash
#openssl rand -out 1G.rnd -base64 $(( 2**30 * 3/4 ))
# File should not be too small, otherwise measuring differences becomes harder
# And not be too big, otherwise it just takes too long...
testfile=$1
# Print header
echo "cipher;time"
# First get the testfile into cache:
cat ${testfile} > /dev/null
cat ${testfile} > /dev/null
# Now run the tests
for try in `seq 1 10` ; do # I cycle through the ciphers, so that temporary system load is evened out over the ciphers
for cipher in arcfour arcfour256 arcfour128 3des-cbc blowfish-cbc cast128-cbc rijndael-cbc@lysator.liu.se aes128-ctr aes128-cbc aes192-ctr aes192-cbc aes256-ctr aes256-cbc; do
echo -n ${cipher}";"
# To get accurate timing, you need to bypass scp's reporting
bash -c "time -p scp -4 -o Compression=no -c ${cipher} ${testfile} ${USER}@localhost:/dev/null" 2>&1 | head -1 | awk '{print $2}'
done
done
# Graph in R:
# scp_local_speed <- read.csv("scp_local_speed.csv", sep=";");par(mar=c(12,5,1,1));boxplot(time ~ cipher,data=scp_local_speed,las=2,xlab="Cipher",ylab="Time(s)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment