diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-03-08 02:05:54 +0800 |
---|---|---|
committer | Felix Lange <fjl@users.noreply.github.com> | 2017-03-09 22:50:14 +0800 |
commit | 5c8fa6ae1a42813e7aec477bd68d98f66f85e0b8 (patch) | |
tree | 19e34d409d1a999079e007698f33766973676bc8 /crypto | |
parent | b7d93500f13e3054c81196273ebf676ad8ecb5ba (diff) | |
download | dexon-5c8fa6ae1a42813e7aec477bd68d98f66f85e0b8.tar.gz dexon-5c8fa6ae1a42813e7aec477bd68d98f66f85e0b8.tar.zst dexon-5c8fa6ae1a42813e7aec477bd68d98f66f85e0b8.zip |
crypto, pow, vendor: hash optimizations, mmap ethash
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/crypto.go | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go index a60a4617e..0b8c06008 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -37,10 +37,6 @@ var ( secp256k1_halfN = new(big.Int).Div(secp256k1_N, big.NewInt(2)) ) -// Hasher is a repetitive hasher allowing the same hash data structures to be -// reused between hash runs instead of requiring new ones to be created. -type Hasher func(data []byte) []byte - // Keccak256 calculates and returns the Keccak256 hash of the input data. func Keccak256(data ...[]byte) []byte { d := sha3.NewKeccak256() @@ -61,22 +57,6 @@ func Keccak256Hash(data ...[]byte) (h common.Hash) { return h } -// Keccak256Hasher creates a repetitive Keccak256 hasher, allowing the same hash -// data structures to be reused between hash runs instead of requiring new ones -// to be created. -// -// The returned function is not thread safe! -func Keccak256Hasher() Hasher { - hasher := sha3.NewKeccak256() - - return func(data []byte) []byte { - hasher.Write(data) - result := hasher.Sum(nil) - hasher.Reset() - return result - } -} - // Keccak512 calculates and returns the Keccak512 hash of the input data. func Keccak512(data ...[]byte) []byte { d := sha3.NewKeccak512() @@ -86,22 +66,6 @@ func Keccak512(data ...[]byte) []byte { return d.Sum(nil) } -// Keccak512Hasher creates a repetitive Keccak512 hasher, allowing the same hash -// data structures to be reused between hash runs instead of requiring new ones -// to be created. -// -// The returned function is not thread safe! -func Keccak512Hasher() Hasher { - hasher := sha3.NewKeccak512() - - return func(data []byte) []byte { - hasher.Write(data) - result := hasher.Sum(nil) - hasher.Reset() - return result - } -} - // Deprecated: For backward compatibility as other packages depend on these func Sha3Hash(data ...[]byte) common.Hash { return Keccak256Hash(data...) } |