Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- example for a buffer:
- print(hwp.crc_buf(hwp.CRC.RKW, {0, 1, 2, 3})
- -- example with a firmware
- local fw = hwp.load_file("fw.bin")
- local info = hwp.section(fw, "")
- -- extract all bytes expect 44 byte header and 4 bytes at the end
- local buf = hwp.read(fw, hwp.make_addr(info.addr + 44, ""), info.size - 48)
- -- compute CRC
- local crc = hwp.crc_buf(hwp.CRC.RKW, buf)
- -- write CRC
- hwp.write32(fw, hwp.make_addr(info.addr + info.size - 4, crc))
- -- write firmware
- hwp.save_file("fw-mod.bin")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement