3737 secp256k1_halfN = new (big.Int ).Div (secp256k1_N , big .NewInt (2 ))
3838)
3939
40- // Hasher is a repetitive hasher allowing the same hash data structures to be
41- // reused between hash runs instead of requiring new ones to be created.
42- type Hasher func (data []byte ) []byte
43-
4440// Keccak256 calculates and returns the Keccak256 hash of the input data.
4541func Keccak256 (data ... []byte ) []byte {
4642 d := sha3 .NewKeccak256 ()
@@ -61,22 +57,6 @@ func Keccak256Hash(data ...[]byte) (h common.Hash) {
6157 return h
6258}
6359
64- // Keccak256Hasher creates a repetitive Keccak256 hasher, allowing the same hash
65- // data structures to be reused between hash runs instead of requiring new ones
66- // to be created.
67- //
68- // The returned function is not thread safe!
69- func Keccak256Hasher () Hasher {
70- hasher := sha3 .NewKeccak256 ()
71-
72- return func (data []byte ) []byte {
73- hasher .Write (data )
74- result := hasher .Sum (nil )
75- hasher .Reset ()
76- return result
77- }
78- }
79-
8060// Keccak512 calculates and returns the Keccak512 hash of the input data.
8161func Keccak512 (data ... []byte ) []byte {
8262 d := sha3 .NewKeccak512 ()
@@ -86,22 +66,6 @@ func Keccak512(data ...[]byte) []byte {
8666 return d .Sum (nil )
8767}
8868
89- // Keccak512Hasher creates a repetitive Keccak512 hasher, allowing the same hash
90- // data structures to be reused between hash runs instead of requiring new ones
91- // to be created.
92- //
93- // The returned function is not thread safe!
94- func Keccak512Hasher () Hasher {
95- hasher := sha3 .NewKeccak512 ()
96-
97- return func (data []byte ) []byte {
98- hasher .Write (data )
99- result := hasher .Sum (nil )
100- hasher .Reset ()
101- return result
102- }
103- }
104-
10569// Deprecated: For backward compatibility as other packages depend on these
10670func Sha3Hash (data ... []byte ) common.Hash { return Keccak256Hash (data ... ) }
10771
0 commit comments