wycheproof_utils.py raw

   1  # Copyright (c) 2024 Random "Randy" Lattice and Sean Andersen
   2  # Distributed under the MIT software license, see the accompanying
   3  # file COPYING or https://www.opensource.org/licenses/mit-license.php.
   4  '''
   5  Utility functions for generating C files for testvectors from the Wycheproof project.
   6  '''
   7  
   8  def to_c_array(x):
   9      if x == "":
  10          return ""
  11      s = ',0x'.join(a + b for a, b in zip(x[::2], x[1::2]))
  12      return "0x" + s
  13