Convert hex or base64 to binary on the Linux command line
base64:
base64 -d infile.base64 > outfile.bin
hex (untested):
xxd -r -p input.txt output.bin
https://stackoverflow.com/questions/7826526/transform-a-hex-info-to-binary-using-linux-command