37
37
secp256k1_halfN = new (big.Int ).Div (secp256k1_N , big .NewInt (2 ))
38
38
)
39
39
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
-
44
40
// Keccak256 calculates and returns the Keccak256 hash of the input data.
45
41
func Keccak256 (data ... []byte ) []byte {
46
42
d := sha3 .NewKeccak256 ()
@@ -61,22 +57,6 @@ func Keccak256Hash(data ...[]byte) (h common.Hash) {
61
57
return h
62
58
}
63
59
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
-
80
60
// Keccak512 calculates and returns the Keccak512 hash of the input data.
81
61
func Keccak512 (data ... []byte ) []byte {
82
62
d := sha3 .NewKeccak512 ()
@@ -86,22 +66,6 @@ func Keccak512(data ...[]byte) []byte {
86
66
return d .Sum (nil )
87
67
}
88
68
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
-
105
69
// Deprecated: For backward compatibility as other packages depend on these
106
70
func Sha3Hash (data ... []byte ) common.Hash { return Keccak256Hash (data ... ) }
107
71
0 commit comments