Skip to content

Commit

Permalink
Add support for references in all tables
Browse files Browse the repository at this point in the history
  • Loading branch information
GiacomoPope committed Aug 16, 2022
1 parent 6f99ecd commit e2e11fe
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
2 changes: 2 additions & 0 deletions assumptions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cssi:
- castryck-decru
reduces_to:
- cssi-random
references:
JDF11: 'https://doi.org/10.1007/978-3-642-25405-5_2'
comments: >-
Blabla
Expand Down
3 changes: 3 additions & 0 deletions schemes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ sidh:
type: Key Exchange
assumptions:
- sidh
references:
JDF11: 'https://doi.org/10.1007/978-3-642-25405-5_2'
DJP14: 'https://eprint.iacr.org/2011/506'

sike:
name:
Expand Down
26 changes: 15 additions & 11 deletions src/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ def name(self):
return f'<abbr title="{ self.props["name"]["long"] }">{ self.props["name"]["short"] }</abbr>'
else:
return self.props['name'].get('short') or self.props['name'].get('long')

def reference(self):
links = []
reference_dict = self.props.get("references", {})

for slug, url in reference_dict.items():
link = f'<a class="reference-link" href="{url}" target="_blank">{slug}</a>'
links.append(link)
if links:
return " ".join(links)
return "-"

class Attack(Entry):
header = """
Expand Down Expand Up @@ -54,17 +65,6 @@ def complexity(self):
'subexp': SecLvl.SUBEXP,
'exp': SecLvl.EXP }[self.props['complexity']]

def reference(self):
links = []
reference_dict = self.props.get("references", {})

for slug, url in reference_dict.items():
link = f'<a class="reference-link" href="{url}" target="_blank">{slug}</a>'
links.append(link)
if links:
return " ".join(links)
return "-"

class Trivial(Attack):
def __init__(self):
self.id = 'trivial'
Expand All @@ -79,6 +79,7 @@ class Assumption(Entry):
<th>Name</th>
<th>Classical Security</th>
<th>Quantum Security</th>
<th>Reference</th>
</tr>
"""
template = Template("""
Expand All @@ -92,6 +93,7 @@ class Assumption(Entry):
<a href="#{{ this.best_attack().props.id }}"
title="{{ this.best_attack().props.name.long }}">{{ this.security() }}</a>
</td>
<td class="reference">{{ this.reference() }}</td>
</tr>
""")

Expand Down Expand Up @@ -132,6 +134,7 @@ class Scheme(Entry):
<th>Type</th>
<th>Classical Security</th>
<th>Quantum Security</th>
<th>Reference</th>
</tr>
"""
template = Template("""
Expand All @@ -146,6 +149,7 @@ class Scheme(Entry):
<a href="#{{ this.best_attack().props.id }}"
title="{{ this.best_attack().props.name.long }}">{{ this.security() }}</a>
</td>
<td class="reference">{{ this.reference() }}</td>
</tr>
""")

Expand Down

0 comments on commit e2e11fe

Please sign in to comment.