rand: Parallelize generation.

This commit is contained in:
Ole Tange 2016-11-19 00:58:53 +01:00
parent 5bc35e8870
commit 90946afc5b

View file

@ -68,6 +68,11 @@ B<openssl>
# Generate random 8-bit data by AES encrypting /dev/zero with a random # Generate random 8-bit data by AES encrypting /dev/zero with a random
# key # key
randfunc() {
key=$(openssl rand -hex 16) key=$(openssl rand -hex 16)
iv=$(openssl rand -hex 16) iv=$(openssl rand -hex 16)
< /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null < /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null
}
export -f randfunc
# Boost performance by running 1 per CPU core
eval parallel -u randfunc ::: {1..$(parallel --number-of-cores)}