File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -209,10 +209,7 @@ def get_vt_iterator(
209209 if vt :
210210 yield (vt_id , vt )
211211
212- def calculate_vts_collection_hash (self ) -> str :
213- """Calculate the vts collection sha256 hash."""
214- m = sha256 () # pylint: disable=invalid-name
215-
212+ def vt_verification_string_iter (self ) -> str :
216213 # for a reproducible hash calculation
217214 # the vts must already be sorted in the dictionary.
218215 for vt_id , vt in self .get_vt_iterator (details = False ):
@@ -226,12 +223,17 @@ def calculate_vts_collection_hash(self) -> str:
226223 + param .get ('name' )
227224 + param .get ('default' )
228225 )
229-
230- m .update (
226+ yield (
231227 (vt_id + vt .get ('modification_time' )).encode ('utf-8' )
232228 + param_chain .encode ('utf-8' )
233229 )
234230
231+ def calculate_vts_collection_hash (self ) -> str :
232+ """Calculate the vts collection sha256 hash."""
233+ m = sha256 () # pylint: disable=invalid-name
234+
235+ for chunk in self .vt_verification_string_iter ():
236+ m .update (chunk )
235237 return m .hexdigest ()
236238
237239 def get_severity_score (self , vt_aux : dict ) -> Optional [float ]:
You can’t perform that action at this time.
0 commit comments