Skip to content

Commit

Permalink
Tweak the number of decimal places to round to
Browse files Browse the repository at this point in the history
  • Loading branch information
micahflee committed Oct 1, 2018
1 parent a3e395b commit 9e0c2a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/calc_passphrase_strength.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def seconds_to_printable(seconds):
elif years < 1000:
return "{0} y".format(years)
elif years < 1000000:
return "{0:.2f}k y".format(years / 1000)
return "{0:.1f}k y".format(years / 1000)
elif years < 1000000000:
return "{0}M y".format(math.floor(years / 1000000))
elif years < 1000000000000:
Expand Down Expand Up @@ -73,7 +73,7 @@ def main():
avg_time_seconds = time_seconds / 2 # attacks have to search half the keyspace on average

row_num_words.append("{0}".format(num_words))
row_entropy.append("{0:.3f}".format(num_words * entropy_per_word))
row_entropy.append("{0:.1f}".format(num_words * entropy_per_word))
row_time.append(seconds_to_printable(avg_time_seconds))

table_data = [
Expand Down

0 comments on commit 9e0c2a6

Please sign in to comment.