INNER CODE UNIT · Python

gen_byte_array

BlockstreamResearch/secp256k1-zkp · tools/tests_silentpayments_generate.py:68

def gen_byte_array(hex):
    assert len(hex) % 2 == 0
    if hex == "":
        return "{0x00}"
    s = ',0x'.join(a + b for a, b in zip(hex[::2], hex[1::2]))
    return "{0x" + s + "}"

def maybe_gen_comment(comment):
    if comment:
        return f" /* {comment} */"
    else:
        return ""

def gen_key_material(keys, comment=None, prepend_count=False):
    assert len(keys) <= MAX_INPUTS_PER_TEST_CASE
    out = ""
    if prepend_count:
        out += f"        {len(keys)},\n"

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…