Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bytes = {0xA9, 0x06, 0x06, 0xC6}
- local b1 = bit32.lshift(bit32.band(bytes[1],0xFF),24)
- local b2 = bit32.lshift(bit32.band(bytes[2],0xFF),16)
- local b3 = bit32.lshift(bit32.band(bytes[3],0xFF),8)
- local b4 = bit32.band(bytes[4],0xFF)
- local dword = bit32.bxor(b1,b2,b3,b4) --b1+b2+b3+b4--
- print(('DWord: %02X'):format(dword))
- local b1b = bit32.band(bit32.rshift(dword, 24), 0xFF)
- local b2b = bit32.band(bit32.rshift(dword, 16), 0xFF)
- local b3b = bit32.band(bit32.rshift(dword, 8), 0xFF)
- local b4b = bit32.band(dword, 0xFF)
- print(('b1: 0x%02X b2: 0x:%02X b3: %02X b4: %02X'):format(b1b,b2b,b3b,b4b))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement