aboutsummaryrefslogtreecommitdiffstats
path: root/common/registrar
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-02-24 19:57:57 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-02-24 19:57:57 +0800
commit483feb0d3f015f103f80dbaf2aca9a130f5d964c (patch)
tree8137bf41be9b84bc6797ec55c861332b2efc3ab1 /common/registrar
parent1415669ac31cf8f06d107e06681b95c2b5e1c040 (diff)
parent139f6a0f4c1b3358a92bdfb5637878b2c97eba78 (diff)
downloaddexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar.gz
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar.bz2
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar.lz
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar.xz
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.tar.zst
dexon-483feb0d3f015f103f80dbaf2aca9a130f5d964c.zip
Merge pull request #2242 from jimenezrick/upstream-crypto
Closes #2241: Use Keccak-256 from golang.org/x/crypto/sha3 and mention explicitly
Diffstat (limited to 'common/registrar')
-rw-r--r--common/registrar/ethreg/api.go2
-rw-r--r--common/registrar/registrar.go4
-rw-r--r--common/registrar/registrar_test.go2
3 files changed, 4 insertions, 4 deletions
diff --git a/common/registrar/ethreg/api.go b/common/registrar/ethreg/api.go
index 1ba422c4d..79a6c2191 100644
--- a/common/registrar/ethreg/api.go
+++ b/common/registrar/ethreg/api.go
@@ -86,7 +86,7 @@ func (api *PrivateRegistarAPI) Register(sender common.Address, addr common.Addre
}
codeb := state.GetCode(addr)
- codeHash := common.BytesToHash(crypto.Sha3(codeb))
+ codeHash := common.BytesToHash(crypto.Keccak256(codeb))
contentHash := common.HexToHash(contentHashHex)
_, err = registrar.New(api.be).SetHashToHash(sender, codeHash, contentHash)
diff --git a/common/registrar/registrar.go b/common/registrar/registrar.go
index 24e45edb3..0606f6985 100644
--- a/common/registrar/registrar.go
+++ b/common/registrar/registrar.go
@@ -68,7 +68,7 @@ const (
)
func abiSignature(s string) string {
- return common.ToHex(crypto.Sha3([]byte(s))[:4])
+ return common.ToHex(crypto.Keccak256([]byte(s))[:4])
}
var (
@@ -401,7 +401,7 @@ func storageMapping(addr, key []byte) []byte {
data := make([]byte, 64)
copy(data[0:32], key[0:32])
copy(data[32:64], addr[0:32])
- sha := crypto.Sha3(data)
+ sha := crypto.Keccak256(data)
return sha
}
diff --git a/common/registrar/registrar_test.go b/common/registrar/registrar_test.go
index 68ee65ab4..b2287803c 100644
--- a/common/registrar/registrar_test.go
+++ b/common/registrar/registrar_test.go
@@ -31,7 +31,7 @@ type testBackend struct {
var (
text = "test"
codehash = common.StringToHash("1234")
- hash = common.BytesToHash(crypto.Sha3([]byte(text)))
+ hash = common.BytesToHash(crypto.Keccak256([]byte(text)))
url = "bzz://bzzhash/my/path/contr.act"
)