from capstone import Cs, CS_ARCH_ARM, CS_MODE_ARM
hex_bytes = bytes.fromhex("E3A00001")
md = Cs(CS_ARCH_ARM, CS_MODE_ARM)
for insn in md.disasm(hex_bytes, 0x1000):
print(f"0xinsn.address:x: insn.mnemonic insn.op_str")
If you’ve ever looked at a raw binary dump, a firmware update, or disassembly output, you’ve likely seen strings of hexadecimal numbers. When working with ARM processors (found in phones, Raspberry Pis, embedded devices, and most modern electronics), those hex values often represent actual ARM or Thumb instructions. Understanding how to convert them can help with reverse engineering, debugging, or learning how compilers work.
This guide explains how to convert hexadecimal machine code to ARM assembly instructions – both manually for learning and using tools for real work.
Key tools:
from capstone import Cs, CS_ARCH_ARM, CS_MODE_ARM
hex_code = "1EFF2FE1" # BX LR in little-endian ARM mode
bytes_code = bytes.fromhex(hex_code)
md = Cs(CS_ARCH_ARM, CS_MODE_ARM)
for insn in md.disasm(bytes_code, 0x1000):
print(f"0xinsn.address:x:\tinsn.mnemonic\tinsn.op_str")
Output:
0x1000: bx lr