Advertisement
FlyFar

bin2hex

Mar 28th, 2023 (edited)
638
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | Cybersecurity | 0 0
  1. #CONVERT THE FILE BOOT.ASM TO BOOT.BIN FIRST
  2. import binascii
  3. with open("boot.bin", "rb") as f:
  4.     binary_data = f.read()
  5. hex_values = ["0x{:02X}".format(byte) for byte in binary_data]
  6. print(hex_values)
  7. hex_string = ", ".join(hex_values)
  8. print(hex_string)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement