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 /whisper | |
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 'whisper')
-rw-r--r-- | whisper/envelope.go | 6 | ||||
-rw-r--r-- | whisper/message.go | 2 | ||||
-rw-r--r-- | whisper/topic.go | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/whisper/envelope.go b/whisper/envelope.go index b231c6b44..97d489b96 100644 --- a/whisper/envelope.go +++ b/whisper/envelope.go @@ -66,7 +66,7 @@ func (self *Envelope) Seal(pow time.Duration) { for i := 0; i < 1024; i++ { binary.BigEndian.PutUint32(d[60:], nonce) - firstBit := common.FirstBitSet(common.BigD(crypto.Sha3(d))) + firstBit := common.FirstBitSet(common.BigD(crypto.Keccak256(d))) if firstBit > bestBit { self.Nonce, bestBit = nonce, firstBit } @@ -123,7 +123,7 @@ func (self *Envelope) Open(key *ecdsa.PrivateKey) (msg *Message, err error) { func (self *Envelope) Hash() common.Hash { if (self.hash == common.Hash{}) { enc, _ := rlp.EncodeToBytes(self) - self.hash = crypto.Sha3Hash(enc) + self.hash = crypto.Keccak256Hash(enc) } return self.hash } @@ -142,6 +142,6 @@ func (self *Envelope) DecodeRLP(s *rlp.Stream) error { if err := rlp.DecodeBytes(raw, (*rlpenv)(self)); err != nil { return err } - self.hash = crypto.Sha3Hash(raw) + self.hash = crypto.Keccak256Hash(raw) return nil } diff --git a/whisper/message.go b/whisper/message.go index 506f142ed..f05b5d8b5 100644 --- a/whisper/message.go +++ b/whisper/message.go @@ -146,7 +146,7 @@ func (self *Message) decrypt(key *ecdsa.PrivateKey) error { // hash calculates the SHA3 checksum of the message flags and payload. func (self *Message) hash() []byte { - return crypto.Sha3(append([]byte{self.Flags}, self.Payload...)) + return crypto.Keccak256(append([]byte{self.Flags}, self.Payload...)) } // bytes flattens the message contents (flags, signature and payload) into a diff --git a/whisper/topic.go b/whisper/topic.go index 7ac3e8dc1..d37eb25ee 100644 --- a/whisper/topic.go +++ b/whisper/topic.go @@ -31,7 +31,7 @@ type Topic [4]byte // Note, empty topics are considered the wildcard, and cannot be used in messages. func NewTopic(data []byte) Topic { prefix := [4]byte{} - copy(prefix[:], crypto.Sha3(data)[:4]) + copy(prefix[:], crypto.Keccak256(data)[:4]) return Topic(prefix) } |