Skip to content

Instantly share code, notes, and snippets.

@lz101010
Last active July 5, 2022 12:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lz101010/113144d07561384b5e515cf58f109353 to your computer and use it in GitHub Desktop.
Save lz101010/113144d07561384b5e515cf58f109353 to your computer and use it in GitHub Desktop.
Visualization of Broken Security Levels over Time
import pandas as pd
import seaborn as sns
from io import StringIO
import matplotlib.pyplot as plt
# source: https://www.wikiwand.com/en/RSA_Factoring_Challenge
rsa_data: str = """
year;bits
1991;330
1992;364
1993;397
1994;426
1996;430
1999;463
2004;496
1999;512
2003;530
2009;563
2003;576
2010;596
2010;629
2005;640
2005;663
2013;696
2012;704
2016;729
2018;762
2020;768
2009;768
2019;795
2020;829
"""
# based on the above data
def linear_regression_rsa(x: int):
return 15.23 * x - 29956
# based loosely on https://www.etsi.org/images/files/ETSIWhitePapers/QuantumSafeWhitepaper.pdf, section 2.2
# disclaimer: the resulting values are only for illustrative purposes
def pqc_speculation(x: int):
assert x in range(2020, 2030)
result = 810
yearly_increase = 16
exp_factor = 1.5
for i in range(2020, x):
result += yearly_increase
yearly_increase *= exp_factor
return result
if __name__ == '__main__':
rsa_df = pd.read_csv(StringIO(rsa_data), sep=';')
regression_range = range(2020, 2030)
reg_df = pd.DataFrame({'year': regression_range, 'bits': [linear_regression_rsa(x) for x in regression_range]})
pqc_df = pd.DataFrame({'year': regression_range, 'bits': [pqc_speculation(x) for x in regression_range]})
fig, plot = plt.subplots(figsize=(6, 6))
sns.regplot(data=rsa_df, ax=plot, x='year', y='bits', marker='x', ci=None)
sns.lineplot(data=reg_df, ax=plot, x='year', y='bits', color='dodgerblue', linestyle='--')
sns.lineplot(data=pqc_df, ax=plot, x='year', y='bits', color='orange', linestyle='--', zorder=1)
subplot = plot.axes
subplot.set_xlabel('')
subplot.set_xticks([1990, 2000, 2010, 2020, 2030])
subplot.set_ylabel('')
subplot.set_yscale('log', base=2)
subplot.set_yticks([512, 1024, 2048])
subplot.set_yticklabels(['RSA-512', 'RSA-1024', 'RSA-2048'])
for y in [512, 1024, 2048]:
plot.axhline(y, linewidth=0.5, color='lightgray', zorder=0)
plt.title('Broken Security Levels over Time', loc='left', y=1.05, fontsize=16)
plt.legend(labels=['solved RSA challenges', 'linear regression', 'projected continuation', 'quantum threat'])
fig.savefig('out.png', bbox_inches='tight', transparent=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment