From 5c19ba3ba7d07d1619e607b65b698e4eb65f6e0c Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Mon, 10 Oct 2016 22:52:38 +0200 Subject: Improve comments --- envelope/gcdtest.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 envelope/gcdtest.sh (limited to 'envelope') diff --git a/envelope/gcdtest.sh b/envelope/gcdtest.sh new file mode 100755 index 0000000..be6ff7e --- /dev/null +++ b/envelope/gcdtest.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash +function go() { + keylen="$1" + total="$2" + for i in $(seq 1 "$total"); do + ./envelope -k "$keylen" 2>&1 | head -1 | cut -d' ' -f3 | outerr + done | sort -n | uniq -c | head -1 | awk '{print $1}' +} + +function percentage() { + printf "%d bits, %d trials: %s%% 2's\n" "$1" "$2" "$(bc <<<"100*$(go $1 $2)/$2")" +} + +percentage "$1" "$2" + +#percentage 512 20 +#percentage 700 20 +#percentage 900 20 +#percentage 1024 10 +#percentage 1400 10 +#percentage 2048 10 -- cgit v1.2.3-70-g09d2