Skip to content

Commit f90bc86

Browse files
gzliudanJukLee0ira
authored andcommitted
crypto: less allocations when hashing and tx handling (ethereum#21265)
1 parent e2e3b30 commit f90bc86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crypto/crypto.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func HashData(kh KeccakState, data []byte) (h common.Hash) {
7575
// Keccak256 calculates and returns the Keccak256 hash of the input data.
7676
func Keccak256(data ...[]byte) []byte {
7777
b := make([]byte, 32)
78-
d := NewKeccakState()
78+
d := sha3.NewLegacyKeccak256().(KeccakState)
7979
for _, b := range data {
8080
d.Write(b)
8181
}
@@ -86,7 +86,7 @@ func Keccak256(data ...[]byte) []byte {
8686
// Keccak256Hash calculates and returns the Keccak256 hash of the input data,
8787
// converting it to an internal Hash data structure.
8888
func Keccak256Hash(data ...[]byte) (h common.Hash) {
89-
d := NewKeccakState()
89+
d := sha3.NewLegacyKeccak256().(KeccakState)
9090
for _, b := range data {
9191
d.Write(b)
9292
}

0 commit comments

Comments
 (0)