SHARE
TWEET

Untitled

a guest Aug 13th, 2014 220 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- example for a buffer:
  2. print(hwp.crc_buf(hwp.CRC.RKW, {0, 1, 2, 3})
  3. -- example with a firmware
  4. local fw = hwp.load_file("fw.bin")
  5. local info = hwp.section(fw, "")
  6. -- extract all bytes expect 44 byte header and 4 bytes at the end
  7. local buf = hwp.read(fw, hwp.make_addr(info.addr + 44, ""), info.size - 48)
  8. -- compute CRC
  9. local crc = hwp.crc_buf(hwp.CRC.RKW, buf)
  10. -- write CRC
  11. hwp.write32(fw, hwp.make_addr(info.addr + info.size - 4, crc))
  12. -- write firmware
  13. hwp.save_file("fw-mod.bin")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top