aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto_test.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-17 08:32:35 +0800
committerFelix Lange <fjl@twurst.com>2015-03-17 08:32:35 +0800
commitad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc (patch)
treecaa6081cbade6c4159206b513d9ec82dc30df2c4 /crypto/crypto_test.go
parent8ce6a3647821706cf5e9bb1a9dc13f23c84f6585 (diff)
downloadgo-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar.gz
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar.bz2
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar.lz
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar.xz
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.tar.zst
go-tangerine-ad78db4d62d392e9462ac4c1f8ac3d9718fdd0fc.zip
crypto: fix Sha3Hash and add a test for it
Diffstat (limited to 'crypto/crypto_test.go')
-rw-r--r--crypto/crypto_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go
index 754287641..63a9c3f5e 100644
--- a/crypto/crypto_test.go
+++ b/crypto/crypto_test.go
@@ -7,8 +7,8 @@ import (
"testing"
"time"
- "github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/ethereum/go-ethereum/common"
+ "github.com/ethereum/go-ethereum/crypto/secp256k1"
)
// These tests are sanity checks.
@@ -21,6 +21,12 @@ func TestSha3(t *testing.T) {
checkhash(t, "Sha3-256", func(in []byte) []byte { return Sha3(in) }, msg, exp)
}
+func TestSha3Hash(t *testing.T) {
+ msg := []byte("abc")
+ exp, _ := hex.DecodeString("4e03657aea45a94fc7d47ba826c8d667c0d1e6e33a64a036ec44f58fa12d6c45")
+ checkhash(t, "Sha3-256-array", func(in []byte) []byte { h := Sha3Hash(in); return h[:] }, msg, exp)
+}
+
func TestSha256(t *testing.T) {
msg := []byte("abc")
exp, _ := hex.DecodeString("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad")