@@ -207,7 +207,7 @@ func (s *DHT) retryStore(ctx context.Context, key []byte, data []byte, typ int)
207207
208208// Store the data into the network
209209func (s * DHT ) Store (ctx context.Context , data []byte , typ int ) (string , error ) {
210- key , _ := utils .Sha3256hash (data )
210+ key , _ := utils .Blake3Hash (data )
211211
212212 retKey := base58 .Encode (key )
213213 // store the key to queries storage
@@ -224,7 +224,7 @@ func (s *DHT) Store(ctx context.Context, data []byte, typ int) (string, error) {
224224 return retKey , nil
225225}
226226
227- // StoreBatch will store a batch of values with their SHA256 hash as the key
227+ // StoreBatch will store a batch of values with their Blake3 hash as the key
228228func (s * DHT ) StoreBatch (ctx context.Context , values [][]byte , typ int , taskID string ) error {
229229 log .WithContext (ctx ).WithField ("taskID" , taskID ).WithField ("records" , len (values )).Info ("store db batch begin" )
230230 if err := s .store .StoreBatch (ctx , values , typ , true ); err != nil {
@@ -823,7 +823,7 @@ func (s *DHT) iterate(ctx context.Context, iterativeType int, target []byte, dat
823823 closestNode := nl .Nodes [0 ]
824824 // if it's a find node, reset the refresh timer
825825 if iterativeType == IterateFindNode {
826- hashedTargetID , _ := utils .Sha3256hash (target )
826+ hashedTargetID , _ := utils .Blake3Hash (target )
827827 bucket := s .ht .bucketIndex (s .ht .self .HashedID , hashedTargetID )
828828 log .P2P ().WithContext (ctx ).Debugf ("bucket for target: %v" , sKey )
829829
@@ -1173,7 +1173,7 @@ func (s *DHT) storeToAlphaNodes(ctx context.Context, nl *NodeList, data []byte,
11731173 }
11741174 }(n )
11751175 }
1176- skey , _ := utils .Sha3256hash (data )
1176+ skey , _ := utils .Blake3Hash (data )
11771177
11781178 // Collect results from parallel requests
11791179 for i := 0 ; i < Alpha && i < len (nl .Nodes ); i ++ {
@@ -1259,7 +1259,7 @@ func (s *DHT) IterateBatchStore(ctx context.Context, values [][]byte, typ int, i
12591259
12601260 log .WithContext (ctx ).WithField ("task-id" , id ).WithField ("keys" , len (values )).Info ("iterate batch store begin" )
12611261 for i := 0 ; i < len (values ); i ++ {
1262- target , _ := utils .Sha3256hash (values [i ])
1262+ target , _ := utils .Blake3Hash (values [i ])
12631263 hashes [i ] = target
12641264 top6 := s .ht .closestContactsWithInlcudingNode (Alpha , target , s .ignorelist .ToNodeList (), nil )
12651265
0 commit comments