@@ -29,7 +29,7 @@ import (
2929 "testing"
3030 "time"
3131
32- "golang.org/x/ crypto/sha3 "
32+ "github.com/XinFinOrg/XDPoSChain/ crypto/keccak "
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 .NewLegacyKeccak256
42+ hashFunc := keccak .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 .NewLegacyKeccak256
215+ hasher := keccak .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 .NewLegacyKeccak256
242+ hasher := keccak .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 .NewLegacyKeccak256
261+ hasher := keccak .NewLegacyKeccak256
262262 pool := NewTreePool (hasher , 128 , maxproccnt )
263263 defer pool .Drain (0 )
264264 wg := sync.WaitGroup {}
@@ -377,7 +377,7 @@ func benchmarkBMTBaseline(n int, t *testing.B) {
377377 tdata := testDataReader (64 )
378378 data := make ([]byte , 64 )
379379 tdata .Read (data )
380- hasher := sha3 .NewLegacyKeccak256
380+ hasher := keccak .NewLegacyKeccak256
381381
382382 t .ReportAllocs ()
383383 t .ResetTimer ()
@@ -405,7 +405,7 @@ func benchmarkHasher(n int, t *testing.B) {
405405 tdata .Read (data )
406406
407407 size := 1
408- hasher := sha3 .NewLegacyKeccak256
408+ hasher := keccak .NewLegacyKeccak256
409409 segmentCount := 128
410410 pool := NewTreePool (hasher , segmentCount , size )
411411 bmt := New (pool )
@@ -424,7 +424,7 @@ func benchmarkHasherReuse(poolsize, n int, t *testing.B) {
424424 data := make ([]byte , n )
425425 tdata .Read (data )
426426
427- hasher := sha3 .NewLegacyKeccak256
427+ hasher := keccak .NewLegacyKeccak256
428428 segmentCount := 128
429429 pool := NewTreePool (hasher , segmentCount , poolsize )
430430 cycles := 200
@@ -449,7 +449,7 @@ func benchmarkSHA3(n int, t *testing.B) {
449449 data := make ([]byte , n )
450450 tdata := testDataReader (n )
451451 tdata .Read (data )
452- hasher := sha3 .NewLegacyKeccak256
452+ hasher := keccak .NewLegacyKeccak256
453453 h := hasher ()
454454
455455 t .ReportAllocs ()
@@ -465,7 +465,7 @@ func benchmarkRefHasher(n int, t *testing.B) {
465465 data := make ([]byte , n )
466466 tdata := testDataReader (n )
467467 tdata .Read (data )
468- hasher := sha3 .NewLegacyKeccak256
468+ hasher := keccak .NewLegacyKeccak256
469469 rbmt := NewRefHasher (hasher , 128 )
470470
471471 t .ReportAllocs ()
0 commit comments