diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2016-04-19 15:58:26 +0900 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2016-04-19 15:58:26 +0900 |
commit | 7c2cdaa6e40999d1194cc7188742f0c21acfa0da (patch) | |
tree | 0b70c3be9d96745a4b4b3571e813cf807f81a23b /example-fs-bb48/gen_crc_table.py | |
parent | 0bbb43dd3a943285ffb5462db468f7af29c4bbfb (diff) |
Example for FS-BB48 to compute CRC32.
Diffstat (limited to 'example-fs-bb48/gen_crc_table.py')
-rw-r--r-- | example-fs-bb48/gen_crc_table.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/example-fs-bb48/gen_crc_table.py b/example-fs-bb48/gen_crc_table.py new file mode 100644 index 0000000..908531a --- /dev/null +++ b/example-fs-bb48/gen_crc_table.py @@ -0,0 +1,22 @@ +# +# Polynomial for CRC32: +# x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 +# +# When it is represented in binary, it's: +# 0x04C11DB7 +# = +# 0000 0100 1100 0001 0001 1101 1011 0111 +# +# When we put in reverse bit-order, it's +# 0xedb88320 + +for i in range(0,256): + c = i + for j in range(0,8): + if (c&1): + c = 0xEDB88320 ^ (c >> 1) + else: + c = c >> 1 + print("0x%08x," % c), + if (i % 6) == 5: + print("") |