RosettaCodeData/Task/CRC-32/11l/crc-32.11l
2026-02-01 16:33:20 -08:00

18 lines
382 B
Text
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

V crc_table = [0] * 256
L(i) 0.<256
UInt32 rem = i
L 8
I rem [&] 1 != 0
rem >>= 1
rem (+)= EDB8'8320
E
rem >>= 1
crc_table[i] = rem
F crc32(buf, =crc = UInt32(0))
crc = ~crc
L(k) buf
crc = (crc >> 8) (+) :crc_table[(crc [&] F'F) (+) k.code]
R ~crc
print(hex(crc32(The quick brown fox jumps over the lazy dog)))