File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1
1
.keystore * /
2
2
.blockstore * /
3
3
bcn
4
+ coverage.cov
Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ type Hash [32]byte
14
14
15
15
func NewHash (val any ) Hash {
16
16
jval , _ := json .Marshal (val )
17
- hash := make ([]byte , 64 )
18
- sha3 .ShakeSum256 (hash , jval )
19
- return Hash (hash [:32 ])
17
+ state := sha3 .NewLegacyKeccak256 ()
18
+ _ , _ = state .Write (jval )
19
+ hash := state .Sum (nil )
20
+ return Hash (hash )
20
21
}
21
22
22
23
func (h Hash ) String () string {
Original file line number Diff line number Diff line change @@ -127,9 +127,10 @@ type Hash [32]byte
127
127
128
128
func NewHash(val any) Hash {
129
129
jval, _ := json.Marshal(val)
130
- hash := make([]byte, 64)
131
- sha3.ShakeSum256(hash, jval)
132
- return Hash(hash[:32])
130
+ state := sha3.NewLegacyKeccak256()
131
+ _, _ = state.Write(jval)
132
+ hash := state.Sum(nil)
133
+ return Hash(hash)
133
134
}
134
135
135
136
func (h Hash) String() string {
You can’t perform that action at this time.
0 commit comments