#!/usr/bin/env python

import sys
from Crypto import Random
from Crypto.Cipher import AES
from Crypto.Util import Counter

def main() -> None:
	IN_FILE = sys.argv[1]
	OUT_FILE = sys.argv[2]

#	IN_FILE = "build/wellhub.bin"
#	OUT_FILE = "out.enc"

	rand = Random.new()

	with open(IN_FILE, "rb") as f_in, open(OUT_FILE, "wb") as f_out:
		inp = f_in.read(-1)

		ran = rand.read(24)
		sig = b'wellhub0'

		header = []
		header += (ran)
		header += (sig)
		header += inp

		raw = bytearray(header)

		key = b"thirty two bytes key sdf asdf 32"
		cipher = AES.new(key, AES.MODE_CBC)

		ciphertext = cipher.encrypt(raw)

		f_out.write(ciphertext)


if __name__ == "__main__":
	main()
    