diff options
Diffstat (limited to 'src/pkg/crypto/md5/md5_test.go')
-rw-r--r-- | src/pkg/crypto/md5/md5_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pkg/crypto/md5/md5_test.go b/src/pkg/crypto/md5/md5_test.go index a8b7a1a52..e7faf4961 100644 --- a/src/pkg/crypto/md5/md5_test.go +++ b/src/pkg/crypto/md5/md5_test.go @@ -5,6 +5,7 @@ package md5 import ( + "crypto/rand" "fmt" "io" "testing" @@ -105,6 +106,18 @@ func TestLarge(t *testing.T) { } } +// Tests that blockGeneric (pure Go) and block (in assembly for amd64, 386, arm) match. +func TestBlockGeneric(t *testing.T) { + gen, asm := New().(*digest), New().(*digest) + buf := make([]byte, BlockSize*20) // arbitrary factor + rand.Read(buf) + blockGeneric(gen, buf) + block(asm, buf) + if *gen != *asm { + t.Error("block and blockGeneric resulted in different states") + } +} + var bench = New() var buf = make([]byte, 8192+1) var sum = make([]byte, bench.Size()) |