File: wycheproof_utils.py

package info (click to toggle)
libsecp256k1 0.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 6,368 kB
  • sloc: ansic: 44,731; python: 772; asm: 736; makefile: 282; sh: 227
file content (12 lines) | stat: -rw-r--r-- 427 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
# Copyright (c) 2024 Random "Randy" Lattice and Sean Andersen
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://www.opensource.org/licenses/mit-license.php.
'''
Utility functions for generating C files for testvectors from the Wycheproof project.
'''

def to_c_array(x):
    if x == "":
        return ""
    s = ',0x'.join(a + b for a, b in zip(x[::2], x[1::2]))
    return "0x" + s