[JimA posts his Python rendering of Gary Brown's code] Yup! That's the zip algorithm, right down to the absurdly bit-reversed polynomial. > def crc32(string): > crc = 0xFFFFFFFF > for ch in string: > crc = crc_32_tab[((crc) ^ ord(ch)) & 0xff] ^ (((crc) >> 8) & > 0xFFFFFF) > return ~crc Note that the last line is better (whether in Python or C!) as return crc ^ 0xffffffff Else you'll get a surprising result in a 64-bit Python, and in some 64-bit C implementations. it's-a-32-bit-algorithm-not-an-"int"-or-"long"-one-ly y'rs - tim
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4