summaryrefslogtreecommitdiff
path: root/internal/speed/speed_test.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-02-22 23:55:43 +0100
committerJakob Unterwurzacher2017-02-22 23:56:34 +0100
commit1e03e059fa0980db8d527f1c01094999d8813b95 (patch)
tree950f537f1fa58e9f0506a540b31d790030e69a1d /internal/speed/speed_test.go
parentb056776a013813e251aa37027c3aaa3f1e22d7c8 (diff)
Implement "gocryptfs -speed"
A crypto benchmark mode like "openssl speed". Example run: $ ./gocryptfs -speed AES-GCM-256-OpenSSL 180.89 MB/s (selected in auto mode) AES-GCM-256-Go 48.19 MB/s AES-SIV-512-Go 37.40 MB/s
Diffstat (limited to 'internal/speed/speed_test.go')
-rw-r--r--internal/speed/speed_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/speed/speed_test.go b/internal/speed/speed_test.go
new file mode 100644
index 0000000..1e9d859
--- /dev/null
+++ b/internal/speed/speed_test.go
@@ -0,0 +1,29 @@
+package speed
+
+/*
+Make the "-speed" benchmarks also accessible to the standard test system.
+Example run:
+
+$ go test -bench .
+BenchmarkStupidGCM-2 100000 22552 ns/op 181.62 MB/s
+BenchmarkGoGCM-2 20000 81871 ns/op 50.03 MB/s
+BenchmarkAESSIV-2 10000 104623 ns/op 39.15 MB/s
+PASS
+ok github.com/rfjakob/gocryptfs/internal/speed 6.022s
+*/
+
+import (
+ "testing"
+)
+
+func BenchmarkStupidGCM(b *testing.B) {
+ bStupidGCM(b)
+}
+
+func BenchmarkGoGCM(b *testing.B) {
+ bGoGCM(b)
+}
+
+func BenchmarkAESSIV(b *testing.B) {
+ bAESSIV(b)
+}