HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/396/platform/gsutil/third_party/crcmod/docs/source/make_predefined_table.py
from __future__ import print_function

import numbers

import crcmod.predefined

table_data = [
    [   "Name",            'name',     32,    ],
    [   "Polynomial",      'poly',     22,    ],
    [   "Reversed?",       'reverse',  10,    ],
    [   "Init-value",      'init',     20,    ],
    [   "XOR-out",         'xor_out',  20,    ],
    [   "Check",           'check',    20,    ],
]

ccitt_defns = [
    'kermit',
    'crc-ccitt-false',
    'crc-aug-ccitt',
]

column_dashes = '  '.join(('=' * table_data_item[2] for table_data_item in table_data))
print(column_dashes)
print('  '.join(("%-*s" % (table_data_item[2], table_data_item[0]) for table_data_item in table_data)).strip())
print(column_dashes)

for defn in crcmod.predefined._crc_definitions:
    poly_width = crcmod.crcmod._verifyPoly(defn['poly'])
    hex_width = (poly_width + 3) // 4
    defn_data_list = []
    for (header_text, key, width) in table_data:
        if isinstance(defn[key], bool):
            item = "%s" % (defn[key],)
        elif isinstance(defn[key], numbers.Integral):
            item = "0x%0*X" % (hex_width, defn[key])
        else:
            item = "``%s``" % (defn[key])
            if defn['name'] in ccitt_defns:
                item = ' '.join([item, '[#ccitt]_'])
        item = "%-*s" % (width, item)
        defn_data_list.append(item)
    print('  '.join(defn_data_list).strip())

print(column_dashes)