diff options
Diffstat (limited to 'src/pkg/crypto/ripemd160')
-rw-r--r-- | src/pkg/crypto/ripemd160/Makefile | 2 | ||||
-rw-r--r-- | src/pkg/crypto/ripemd160/ripemd160.go | 5 | ||||
-rw-r--r-- | src/pkg/crypto/ripemd160/ripemd160_test.go | 16 |
3 files changed, 10 insertions, 13 deletions
diff --git a/src/pkg/crypto/ripemd160/Makefile b/src/pkg/crypto/ripemd160/Makefile index 109e68eda..7e529457d 100644 --- a/src/pkg/crypto/ripemd160/Makefile +++ b/src/pkg/crypto/ripemd160/Makefile @@ -2,7 +2,7 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. -include ../../../Make.$(GOARCH) +include ../../../Make.inc TARG=crypto/ripemd160 GOFILES=\ diff --git a/src/pkg/crypto/ripemd160/ripemd160.go b/src/pkg/crypto/ripemd160/ripemd160.go index 5d5519842..5614f1360 100644 --- a/src/pkg/crypto/ripemd160/ripemd160.go +++ b/src/pkg/crypto/ripemd160/ripemd160.go @@ -72,10 +72,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { n := _Block(d, p) p = p[n:] if len(p) > 0 { - for i, x := range p { - d.x[i] = x - } - d.nx = len(p) + d.nx = copy(d.x[:], p) } return } diff --git a/src/pkg/crypto/ripemd160/ripemd160_test.go b/src/pkg/crypto/ripemd160/ripemd160_test.go index eaa3d78c2..f4135f5cf 100644 --- a/src/pkg/crypto/ripemd160/ripemd160_test.go +++ b/src/pkg/crypto/ripemd160/ripemd160_test.go @@ -19,14 +19,14 @@ type mdTest struct { } var vectors = [...]mdTest{ - mdTest{"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""}, - mdTest{"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", "a"}, - mdTest{"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", "abc"}, - mdTest{"5d0689ef49d2fae572b881b123a85ffa21595f36", "message digest"}, - mdTest{"f71c27109c692c1b56bbdceb5b9d2865b3708dbc", "abcdefghijklmnopqrstuvwxyz"}, - mdTest{"12a053384a9c0c88e405a06c27dcf49ada62eb2b", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"}, - mdTest{"b0e20b6e3116640286ed3a87a5713079b21f5189", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}, - mdTest{"9b752e45573d4b39f4dbd3323cab82bf63326bfb", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"}, + {"9c1185a5c5e9fc54612808977ee8f548b2258d31", ""}, + {"0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", "a"}, + {"8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", "abc"}, + {"5d0689ef49d2fae572b881b123a85ffa21595f36", "message digest"}, + {"f71c27109c692c1b56bbdceb5b9d2865b3708dbc", "abcdefghijklmnopqrstuvwxyz"}, + {"12a053384a9c0c88e405a06c27dcf49ada62eb2b", "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"}, + {"b0e20b6e3116640286ed3a87a5713079b21f5189", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}, + {"9b752e45573d4b39f4dbd3323cab82bf63326bfb", "12345678901234567890123456789012345678901234567890123456789012345678901234567890"}, } func TestVectors(t *testing.T) { |