Changeset View
Changeset View
Standalone View
Standalone View
src/bench/data/convert-raw-to-header.py
- This file was added.
Property | Old Value | New Value |
---|---|---|
File Mode | null | 100755 |
#!/usr/bin/env python | |||||
# Copyright (c) 2019 The Bitcoin developers | |||||
import sys | |||||
def main(test_name, input_file): | |||||
with open(input_file, "rb") as f: | |||||
contents = f.read() | |||||
print("static unsigned const char {}[] = {{".format(test_name)) | |||||
print(", ".join(map(lambda x: "0x{:02x}".format(ord(x)), contents))) | |||||
print("};") | |||||
if __name__ == "__main__": | |||||
if len(sys.argv) != 3: | |||||
print("We need additional pylons!") | |||||
sys.exit(1) | |||||
main(sys.argv[1], sys.argv[2]) |