erigon-pulse/erigon-lib/crypto/cryptopool/pool.go
battlmonstr 231e468e19 Add 'erigon-lib/' from commit '93d9c9d9fe4bd8a49f7a98a6bce0f0da7094c7d3'
git-subtree-dir: erigon-lib
git-subtree-mainline: 3c8cbda809
git-subtree-split: 93d9c9d9fe
2023-09-20 14:50:25 +02:00

22 lines
314 B
Go

package cryptopool
import (
"hash"
"sync"
"golang.org/x/crypto/sha3"
)
var pool = sync.Pool{
New: func() interface{} {
return sha3.NewLegacyKeccak256()
},
}
func GetLegacyKeccak256() hash.Hash {
h := pool.Get().(hash.Hash)
h.Reset()
return h
}
func ReturnLegacyKeccak256(h hash.Hash) { pool.Put(h) }