@@ -29,7 +29,7 @@ import (
29
29
"testing"
30
30
"time"
31
31
32
- "github.com/XinFinOrg/XDPoSChain /crypto/sha3"
32
+ "golang.org/x /crypto/sha3"
33
33
)
34
34
35
35
const (
@@ -39,7 +39,7 @@ const (
39
39
// TestRefHasher tests that the RefHasher computes the expected BMT hash for
40
40
// all data lengths between 0 and 256 bytes
41
41
func TestRefHasher (t * testing.T ) {
42
- hashFunc := sha3 .NewKeccak256
42
+ hashFunc := sha3 .NewLegacyKeccak256
43
43
44
44
sha3 := func (data ... []byte ) []byte {
45
45
h := hashFunc ()
@@ -212,7 +212,7 @@ func testHasher(f func(BaseHasher, []byte, int, int) error) error {
212
212
tdata := testDataReader (4128 )
213
213
data := make ([]byte , 4128 )
214
214
tdata .Read (data )
215
- hasher := sha3 .NewKeccak256
215
+ hasher := sha3 .NewLegacyKeccak256
216
216
size := hasher ().Size ()
217
217
counts := []int {1 , 2 , 3 , 4 , 5 , 8 , 16 , 32 , 64 , 128 }
218
218
@@ -239,7 +239,7 @@ func TestHasherReuseWithRelease(t *testing.T) {
239
239
}
240
240
241
241
func testHasherReuse (i int , t * testing.T ) {
242
- hasher := sha3 .NewKeccak256
242
+ hasher := sha3 .NewLegacyKeccak256
243
243
pool := NewTreePool (hasher , 128 , i )
244
244
defer pool .Drain (0 )
245
245
bmt := New (pool )
@@ -258,7 +258,7 @@ func testHasherReuse(i int, t *testing.T) {
258
258
}
259
259
260
260
func TestHasherConcurrency (t * testing.T ) {
261
- hasher := sha3 .NewKeccak256
261
+ hasher := sha3 .NewLegacyKeccak256
262
262
pool := NewTreePool (hasher , 128 , maxproccnt )
263
263
defer pool .Drain (0 )
264
264
wg := sync.WaitGroup {}
@@ -379,7 +379,7 @@ func benchmarkBMTBaseline(n int, t *testing.B) {
379
379
tdata := testDataReader (64 )
380
380
data := make ([]byte , 64 )
381
381
tdata .Read (data )
382
- hasher := sha3 .NewKeccak256
382
+ hasher := sha3 .NewLegacyKeccak256
383
383
384
384
t .ReportAllocs ()
385
385
t .ResetTimer ()
@@ -409,7 +409,7 @@ func benchmarkHasher(n int, t *testing.B) {
409
409
tdata .Read (data )
410
410
411
411
size := 1
412
- hasher := sha3 .NewKeccak256
412
+ hasher := sha3 .NewLegacyKeccak256
413
413
segmentCount := 128
414
414
pool := NewTreePool (hasher , segmentCount , size )
415
415
bmt := New (pool )
@@ -428,7 +428,7 @@ func benchmarkHasherReuse(poolsize, n int, t *testing.B) {
428
428
data := make ([]byte , n )
429
429
tdata .Read (data )
430
430
431
- hasher := sha3 .NewKeccak256
431
+ hasher := sha3 .NewLegacyKeccak256
432
432
segmentCount := 128
433
433
pool := NewTreePool (hasher , segmentCount , poolsize )
434
434
cycles := 200
@@ -455,7 +455,7 @@ func benchmarkSHA3(n int, t *testing.B) {
455
455
data := make ([]byte , n )
456
456
tdata := testDataReader (n )
457
457
tdata .Read (data )
458
- hasher := sha3 .NewKeccak256
458
+ hasher := sha3 .NewLegacyKeccak256
459
459
h := hasher ()
460
460
461
461
t .ReportAllocs ()
@@ -471,7 +471,7 @@ func benchmarkRefHasher(n int, t *testing.B) {
471
471
data := make ([]byte , n )
472
472
tdata := testDataReader (n )
473
473
tdata .Read (data )
474
- hasher := sha3 .NewKeccak256
474
+ hasher := sha3 .NewLegacyKeccak256
475
475
rbmt := NewRefHasher (hasher , 128 )
476
476
477
477
t .ReportAllocs ()
0 commit comments