Created
January 28, 2025 22:27
-
-
Save pedro0311/c63411847949a6480bf22762c91d979f to your computer and use it in GitHub Desktop.
Script useful for testing openssl speed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| TESTS=1 | |
| CPUS=`cat /proc/cpuinfo | grep -c processor` | |
| if [[ ${CPUS} -gt 1 ]]; then TESTS=`expr "${TESTS} ${CPUS}"`; fi | |
| echo "aes-256-cbc:" | |
| for THREADS in ${TESTS} | |
| do | |
| OUTPUT=`openssl speed -evp aes-256-cbc -mr -multi ${THREADS} 2>&1 \ | |
| | grep '^+F' | sed -e 's|:| |g' -e 's|\.[0-9][0-9]||g'` | |
| SUM=0; COUNT=-3 | |
| for RESULT in $OUTPUT | |
| do | |
| COUNT=`expr ${COUNT} + 1` | |
| if [[ ${COUNT} -gt 0 ]]; then SUM=`expr ${SUM} + ${RESULT}`; fi | |
| done | |
| COUNT=`expr ${COUNT} \* 125000` | |
| if [[ ${THREADS} = 1 ]] | |
| then | |
| echo "${THREADS} thread: " `expr ${SUM} / ${COUNT}` Mbps | |
| else | |
| echo "${THREADS} threads:" `expr ${SUM} / ${COUNT}` Mbps | |
| fi | |
| done | |
| echo "chacha20-poly1305:" | |
| for THREADS in ${TESTS} | |
| do | |
| OUTPUT=`openssl speed -evp chacha20-poly1305 -mr -multi ${THREADS} 2>&1 \ | |
| | grep '^+F' | sed -e 's|:| |g' -e 's|\.[0-9][0-9]||g'` | |
| SUM=0; COUNT=-3 | |
| for RESULT in $OUTPUT | |
| do | |
| COUNT=`expr ${COUNT} + 1` | |
| if [[ ${COUNT} -gt 0 ]]; then SUM=`expr ${SUM} + ${RESULT}`; fi | |
| done | |
| COUNT=`expr ${COUNT} \* 125000` | |
| if [[ ${THREADS} = 1 ]] | |
| then | |
| echo "${THREADS} thread: " `expr ${SUM} / ${COUNT}` Mbps | |
| else | |
| echo "${THREADS} threads:" `expr ${SUM} / ${COUNT}` Mbps | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment