diff options
author | Ricardo Catalinas Jiménez <r@untroubled.be> | 2016-02-22 02:40:27 +0800 |
---|---|---|
committer | Ricardo Catalinas Jiménez <r@untroubled.be> | 2016-02-22 06:34:34 +0800 |
commit | 436fc8d76a4871d67a61dc86c1a635e20594a0e6 (patch) | |
tree | 5fad9f69b068f43ca606e2887f5522188e7f9ddd /p2p/discover/udp.go | |
parent | c20d6e5e4ed8eff6d26cd849f90ca42dd5a7040c (diff) | |
download | dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.gz dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.bz2 dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.lz dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.xz dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.tar.zst dexon-436fc8d76a4871d67a61dc86c1a635e20594a0e6.zip |
all: Rename crypto.Sha3{,Hash}() to crypto.Keccak256{,Hash}()
As we aren't really using the standarized SHA-3
Diffstat (limited to 'p2p/discover/udp.go')
-rw-r--r-- | p2p/discover/udp.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/p2p/discover/udp.go b/p2p/discover/udp.go index 81674f552..92b37b1f3 100644 --- a/p2p/discover/udp.go +++ b/p2p/discover/udp.go @@ -448,7 +448,7 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, return nil, err } packet := b.Bytes() - sig, err := crypto.Sign(crypto.Sha3(packet[headSize:]), priv) + sig, err := crypto.Sign(crypto.Keccak256(packet[headSize:]), priv) if err != nil { glog.V(logger.Error).Infoln("could not sign packet:", err) return nil, err @@ -457,7 +457,7 @@ func encodePacket(priv *ecdsa.PrivateKey, ptype byte, req interface{}) ([]byte, // add the hash to the front. Note: this doesn't protect the // packet in any way. Our public key will be part of this hash in // The future. - copy(packet, crypto.Sha3(packet[macSize:])) + copy(packet, crypto.Keccak256(packet[macSize:])) return packet, nil } @@ -509,11 +509,11 @@ func decodePacket(buf []byte) (packet, NodeID, []byte, error) { return nil, NodeID{}, nil, errPacketTooSmall } hash, sig, sigdata := buf[:macSize], buf[macSize:headSize], buf[headSize:] - shouldhash := crypto.Sha3(buf[macSize:]) + shouldhash := crypto.Keccak256(buf[macSize:]) if !bytes.Equal(hash, shouldhash) { return nil, NodeID{}, nil, errBadHash } - fromID, err := recoverNodeID(crypto.Sha3(buf[headSize:]), sig) + fromID, err := recoverNodeID(crypto.Keccak256(buf[headSize:]), sig) if err != nil { return nil, NodeID{}, hash, err } @@ -575,7 +575,7 @@ func (req *findnode) handle(t *udp, from *net.UDPAddr, fromID NodeID, mac []byte // (which is a much bigger packet than findnode) to the victim. return errUnknownNode } - target := crypto.Sha3Hash(req.Target[:]) + target := crypto.Keccak256Hash(req.Target[:]) t.mutex.Lock() closest := t.closest(target, bucketSize).entries t.mutex.Unlock() |