mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 12:16:44 +00:00
Update math.go
This commit is contained in:
parent
f2869793df
commit
f1563edfb3
1 changed files with 6 additions and 6 deletions
|
|
@ -93,18 +93,18 @@ func (p *Params) deriveFields() {
|
||||||
|
|
||||||
// addressValue returns the log value hash of a log emitting address.
|
// addressValue returns the log value hash of a log emitting address.
|
||||||
func addressValue(address common.Address) common.Hash {
|
func addressValue(address common.Address) common.Hash {
|
||||||
var result common.Hash
|
return sha256Value(address[:])
|
||||||
hasher := sha256.New()
|
|
||||||
hasher.Write(address[:])
|
|
||||||
hasher.Sum(result[:0])
|
|
||||||
return result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// topicValue returns the log value hash of a log topic.
|
// topicValue returns the log value hash of a log topic.
|
||||||
func topicValue(topic common.Hash) common.Hash {
|
func topicValue(topic common.Hash) common.Hash {
|
||||||
|
return sha256Value(topic[:])
|
||||||
|
}
|
||||||
|
|
||||||
|
func sha256Value(value []byte) common.Hash {
|
||||||
var result common.Hash
|
var result common.Hash
|
||||||
hasher := sha256.New()
|
hasher := sha256.New()
|
||||||
hasher.Write(topic[:])
|
hasher.Write(value)
|
||||||
hasher.Sum(result[:0])
|
hasher.Sum(result[:0])
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue