@@ -80,21 +80,29 @@ def estimate_threats(self, protocol: str, key_size: int) -> dict:
80
80
"threats" : threats ,
81
81
}
82
82
83
- def generate_report (self , protocols : list [dict ]) -> None :
83
+ def generate_report (
84
+ self , protocols : list [dict ], print_progress : bool = False
85
+ ) -> None :
84
86
"""Predict the threats against several cryptographic protocols.
85
87
86
88
Parameters
87
89
----------
88
90
protocols : list[dict]
89
91
List of cryptographic protocols.
92
+ print_progress : bool, optional
93
+ Whether to print the progress of the report generation, by default False.
90
94
"""
91
- threat_report = [
92
- self .estimate_threats (
93
- protocol_and_key_size ["algorithm" ],
94
- protocol_and_key_size ["keySize" ],
95
+ threat_report = []
96
+ for protocol_and_key_size in protocols :
97
+ algorithm = protocol_and_key_size ["algorithm" ]
98
+ key_size = protocol_and_key_size ["keySize" ]
99
+ if print_progress :
100
+ print (f"Estimating threats for { algorithm } -{ key_size } " )
101
+ threat = self .estimate_threats (
102
+ algorithm ,
103
+ key_size ,
95
104
)
96
- for protocol_and_key_size in protocols
97
- ]
105
+ threat_report .append (threat )
98
106
99
107
self ._threat_report = threat_report
100
108
@@ -163,6 +171,8 @@ def get_report(
163
171
if soonest_threat_only :
164
172
simplified_report_output = []
165
173
for protocol in report_output :
174
+ if not protocol ["threats" ]:
175
+ continue
166
176
lowest_timestamp = protocol ["threats" ][0 ]["timestamp" ]
167
177
soonest_threat = protocol ["threats" ][0 ]
168
178
for threat in protocol ["threats" ]:
0 commit comments