aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-03-17 01:43:09 +0800
committerobscuren <geffobscura@gmail.com>2015-03-17 01:43:09 +0800
commit6aa390abfb8553c3cbbd5fa658f7f3788d3c262c (patch)
tree3aed4fe06788bb8fdac95b15028ef48046e19759 /crypto/crypto.go
parent91b0b14845750c81466880f5f877fe3fcbd03b09 (diff)
parent16df850af2d2da0b7082e246d6f05eb1f1dc0706 (diff)
downloadgo-tangerine-6aa390abfb8553c3cbbd5fa658f7f3788d3c262c.tar.gz
go-tangerine-6aa390abfb8553c3cbbd5fa658f7f3788d3c262c.tar.zst
go-tangerine-6aa390abfb8553c3cbbd5fa658f7f3788d3c262c.zip
Merge branch 'conversion' of github.com-obscure:ethereum/go-ethereum into conversion
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index bc72928ac..1f8dfcf32 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -16,10 +16,10 @@ import (
"errors"
"code.google.com/p/go-uuid/uuid"
+ "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/ethereum/go-ethereum/crypto/sha3"
- "github.com/ethereum/go-ethereum/common"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/ripemd160"
)
@@ -37,6 +37,15 @@ func Sha3(data ...[]byte) []byte {
return d.Sum(nil)
}
+func Sha3Hash(data ...[]byte) (h common.Hash) {
+ d := sha3.NewKeccak256()
+ for _, b := range data {
+ d.Write(b)
+ }
+ d.Sum(h[:])
+ return h
+}
+
// Creates an ethereum address given the bytes and the nonce
func CreateAddress(b []byte, nonce uint64) []byte {
return Sha3(common.NewValue([]interface{}{b, nonce}).Encode())[12:]