From 109a120b397ac16266fe47f7ef8819054ebf8483 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 17 Jan 2016 21:27:51 +0100 Subject: [PATCH] Fix RandomReader --- crypto/crypto_test.go | 6 ++---- test/helpers.go | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 50895c65c..a821e105f 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -133,7 +133,6 @@ func TestLargeEncrypt(t *testing.T) { func BenchmarkEncryptWriter(b *testing.B) { size := 8 << 20 // 8MiB - rd := RandomReader(23, size) k := crypto.NewRandomKey() @@ -141,7 +140,7 @@ func BenchmarkEncryptWriter(b *testing.B) { b.SetBytes(int64(size)) for i := 0; i < b.N; i++ { - rd.Seek(0, 0) + rd := RandomReader(23, size) wr := crypto.EncryptTo(k, ioutil.Discard) n, err := io.Copy(wr, rd) OK(b, err) @@ -195,14 +194,13 @@ func BenchmarkEncryptDecryptReader(b *testing.B) { k := crypto.NewRandomKey() size := 8 << 20 // 8MiB - rd := RandomReader(23, size) b.ResetTimer() b.SetBytes(int64(size)) buf := bytes.NewBuffer(nil) for i := 0; i < b.N; i++ { - rd.Seek(0, 0) + rd := RandomReader(23, size) buf.Reset() wr := crypto.EncryptTo(k, buf) _, err := io.Copy(wr, rd) diff --git a/test/helpers.go b/test/helpers.go index 69a75cd2c..bfab04cc9 100644 --- a/test/helpers.go +++ b/test/helpers.go @@ -90,7 +90,6 @@ type rndReader struct { } func (r *rndReader) Read(p []byte) (int, error) { - fmt.Printf("Read(%v)\n", len(p)) for i := range p { p[i] = byte(r.src.Uint32()) }