Example #1
0
def nhpoly1305_linux():
    vectors = topdir / "test_vectors" / "ours" / "NHPoly1305"
    target = targetdir / "nhpoly1305_testvecs_linux.h"
    with target.open("w") as f:
        vectorfile = vectors / f'NHPoly1305.json'
        write_linux_testvecs(
            f, "hash_testvec", 'nhpoly1305', write_linux_hash_testvec,
            sample_nhpoly1305_testvecs(hexjson.iter_unhex(vectorfile)))
Example #2
0
def nh():
    """Convert the NH test vectors."""
    vectors = topdir / "test_vectors" / "ours" / "NH"
    target = targetdir / "nh_testvecs.h"
    with target.open("w") as f:
        f.write("/* GENERATED BY convert_testvecs.py, DO NOT EDIT */\n\n")
        vectorfile = vectors / f'NH.json'
        write_testvec_structs(f, 'nh_testvec', 'nh_tv',
                              (convert_nh_testvec(s)
                               for s in hexjson.iter_unhex(vectorfile)))
Example #3
0
def hpc_vectors(variant, nrounds):
    yield from hexjson.iter_unhex(topdir / "test_vectors" / "ours" / variant /
                                  f'{variant}_XChaCha{nrounds}_32_AES256.json')
Example #4
0
def check_tests(cipher, path, verbose):
    for fn in (path / cipher.name()).iterdir():
        print(f"======== {fn.name} ========")
        for tv in hexjson.iter_unhex(fn):
            check_testvector(cipher, tv, verbose)