From 183e4448d53946d3883a4fa62d38a79aa07ca424 Mon Sep 17 00:00:00 2001 From: Davide Galassi Date: Fri, 26 Jul 2024 17:22:17 +0200 Subject: [PATCH] Update vectors parser script --- ...ietf-vector-schema.py => vectors-print.py} | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) rename data/{ietf-vector-schema.py => vectors-print.py} (64%) diff --git a/data/ietf-vector-schema.py b/data/vectors-print.py similarity index 64% rename from data/ietf-vector-schema.py rename to data/vectors-print.py index 1cb956a..16d09a0 100755 --- a/data/ietf-vector-schema.py +++ b/data/vectors-print.py @@ -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 "-" @@ -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")