Skip to content

Commit

Permalink
Update vectors parser script
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed Jul 26, 2024
1 parent 849c1d4 commit 183e444
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions data/ietf-vector-schema.py → data/vectors-print.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@
import sys


# Max lengths for the entries before splitting on multiple lines
entries_max_lengths = {
# Common stuff
"sk": 64,
"pk": 66,
"alpha": 64,
"ad": 64,
"h": 66,
"gamma": 66,
"beta": 64,
# Ietf proof entries
"proof_c": 64,
"proof_s": 64,
# Pedersen extra entries
"blinding": 64,
"proof_pk_com": 66,
"proof_r": 66,
"proof_ok": 66,
# proof_s (already listed)
"proof_sb": 64
}

def print_entry(entry, key, max_length=64, continuation_prefix=".."):
value = entry.get(key, "-")
text = value if value else "-"
Expand All @@ -23,19 +45,13 @@ def main(file_name):
with open(file_name, 'r') as file:
data = json.load(file)

schema = [
("sk", 64),
("pk", 66),
("alpha", 64),
("ad", 64),
("h", 66),
("gamma", 66),
("beta", 64),
("proof_c", 64),
("proof_s", 64)
]
print("----- SCHEMA -----")
for (key, line_max) in schema:
schema = []
for key in data[0]:
if key == "comment":
continue
len = entries_max_lengths.get(key, 64)
schema.append((key, len))
print(key)
print("------------------\n")

Expand Down

0 comments on commit 183e444

Please sign in to comment.