File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1- const { sha3 , bufferToHex } = require ( 'ethereumjs-util' ) ;
1+ const { keccak256 , bufferToHex } = require ( 'ethereumjs-util' ) ;
22
33class MerkleTree {
44 constructor ( elements ) {
55 // Filter empty strings and hash elements
6- this . elements = elements . filter ( el => el ) . map ( el => sha3 ( el ) ) ;
6+ this . elements = elements . filter ( el => el ) . map ( el => keccak256 ( el ) ) ;
77
88 // Deduplicate elements
99 this . elements = this . bufDedup ( this . elements ) ;
@@ -45,7 +45,7 @@ class MerkleTree {
4545 if ( ! first ) { return second ; }
4646 if ( ! second ) { return first ; }
4747
48- return sha3 ( this . sortAndConcat ( first , second ) ) ;
48+ return keccak256 ( this . sortAndConcat ( first , second ) ) ;
4949 }
5050
5151 getRoot ( ) {
@@ -97,7 +97,7 @@ class MerkleTree {
9797
9898 // Convert element to 32 byte hash if it is not one already
9999 if ( el . length !== 32 || ! Buffer . isBuffer ( el ) ) {
100- hash = sha3 ( el ) ;
100+ hash = keccak256 ( el ) ;
101101 } else {
102102 hash = el ;
103103 }
You can’t perform that action at this time.
0 commit comments