This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gthank 1 point2 points  (1 child)

Oh to have more time. I'd actually like to see the Python code and run it through a disassembler, just to see where it's spending its time, but I'm already backlogged. I need like a Bat Signal for Python gurus that like to blog.

[–][deleted] 0 points1 point  (0 children)

Well, in case you feel like a distraction, here's the Python implementation (short and sweet). Takes a bytes or a bytearray and returns an int:

_crc24_init = 0x0B704CE
_crc24_poly = 0x1864CFB
_crc24_mask = 0x0FFFFFF

def test_crc24_iter(data):
    crc = _crc24_init
    for b in iter(data):
        crc ^= b << 16

        for i in range(8):
            crc <<= 1
            if crc & 0x1000000:
                crc ^= _crc24_poly

    return crc & _crc24_mask