@@ -29,7 +29,7 @@ import (
2929 "testing"
3030 "time"
3131
32- "github.com/XinFinOrg/XDPoSChain /crypto/sha3"
32+ "golang.org/x /crypto/sha3"
3333)
3434
3535const (
@@ -39,7 +39,7 @@ const (
3939// TestRefHasher tests that the RefHasher computes the expected BMT hash for
4040// all data lengths between 0 and 256 bytes
4141func TestRefHasher (t * testing.T ) {
42- hashFunc := sha3 .NewKeccak256
42+ hashFunc := sha3 .NewLegacyKeccak256
4343
4444 sha3 := func (data ... []byte ) []byte {
4545 h := hashFunc ()
@@ -212,7 +212,7 @@ func testHasher(f func(BaseHasher, []byte, int, int) error) error {
212212 tdata := testDataReader (4128 )
213213 data := make ([]byte , 4128 )
214214 tdata .Read (data )
215- hasher := sha3 .NewKeccak256
215+ hasher := sha3 .NewLegacyKeccak256
216216 size := hasher ().Size ()
217217 counts := []int {1 , 2 , 3 , 4 , 5 , 8 , 16 , 32 , 64 , 128 }
218218
@@ -239,7 +239,7 @@ func TestHasherReuseWithRelease(t *testing.T) {
239239}
240240
241241func testHasherReuse (i int , t * testing.T ) {
242- hasher := sha3 .NewKeccak256
242+ hasher := sha3 .NewLegacyKeccak256
243243 pool := NewTreePool (hasher , 128 , i )
244244 defer pool .Drain (0 )
245245 bmt := New (pool )
@@ -258,7 +258,7 @@ func testHasherReuse(i int, t *testing.T) {
258258}
259259
260260func TestHasherConcurrency (t * testing.T ) {
261- hasher := sha3 .NewKeccak256
261+ hasher := sha3 .NewLegacyKeccak256
262262 pool := NewTreePool (hasher , 128 , maxproccnt )
263263 defer pool .Drain (0 )
264264 wg := sync.WaitGroup {}
@@ -379,7 +379,7 @@ func benchmarkBMTBaseline(n int, t *testing.B) {
379379 tdata := testDataReader (64 )
380380 data := make ([]byte , 64 )
381381 tdata .Read (data )
382- hasher := sha3 .NewKeccak256
382+ hasher := sha3 .NewLegacyKeccak256
383383
384384 t .ReportAllocs ()
385385 t .ResetTimer ()
@@ -409,7 +409,7 @@ func benchmarkHasher(n int, t *testing.B) {
409409 tdata .Read (data )
410410
411411 size := 1
412- hasher := sha3 .NewKeccak256
412+ hasher := sha3 .NewLegacyKeccak256
413413 segmentCount := 128
414414 pool := NewTreePool (hasher , segmentCount , size )
415415 bmt := New (pool )
@@ -428,7 +428,7 @@ func benchmarkHasherReuse(poolsize, n int, t *testing.B) {
428428 data := make ([]byte , n )
429429 tdata .Read (data )
430430
431- hasher := sha3 .NewKeccak256
431+ hasher := sha3 .NewLegacyKeccak256
432432 segmentCount := 128
433433 pool := NewTreePool (hasher , segmentCount , poolsize )
434434 cycles := 200
@@ -455,7 +455,7 @@ func benchmarkSHA3(n int, t *testing.B) {
455455 data := make ([]byte , n )
456456 tdata := testDataReader (n )
457457 tdata .Read (data )
458- hasher := sha3 .NewKeccak256
458+ hasher := sha3 .NewLegacyKeccak256
459459 h := hasher ()
460460
461461 t .ReportAllocs ()
@@ -471,7 +471,7 @@ func benchmarkRefHasher(n int, t *testing.B) {
471471 data := make ([]byte , n )
472472 tdata := testDataReader (n )
473473 tdata .Read (data )
474- hasher := sha3 .NewKeccak256
474+ hasher := sha3 .NewLegacyKeccak256
475475 rbmt := NewRefHasher (hasher , 128 )
476476
477477 t .ReportAllocs ()
0 commit comments