0 branches
Tree Top files
Code
Clone with HTTPS:
56 years ago
..

CRC64 Interoperability Fixture

This directory contains interoperability tests for the V hash.crc64 module, cross-validating against reference implementations in C and Python.

Overview

The fixture verifies that hash.crc64 produces identical CRC-64-ECMA-182 checksums when:

Files

Running the fixture

From the V repository root:

v run vlib/hash/crc64/interop/crc64_interop.vsh

Test vectors

The fixture tests 10 vector categories:

  1. empty - Zero-length input
  2. single_a - Single character 'a'
  3. single_null - Single null byte
  4. text_123456789 - Standard test vector
  5. text_hello_world - Common greeting
  6. all_zeros_16 - 16 zero bytes
  7. all_ones_16 - 16 0xFF bytes
  8. repeating_pattern - 150 bytes of "abc" repeated
  9. all_bytes - All 256 byte values in sequence
  10. large_payload - 10000 bytes of "test data " repeatedEach vector is checksummed by:

Polynomial

All implementations use CRC-64-ECMA-182:

Prerequisites

Expected output

Compiling C reference helper...
Running cross-validation tests...
OK: empty => 0x0000000000000000
OK: single_a => 0x926a79e87a919f5d
OK: single_null => 0xbd4a6ec89c7eaafb
...
=== Results ===
Passed: 10
Failed: 0
Total:  10

Troubleshooting

If the fixture fails:

  1. Ensure gcc and python3 are in PATH
  2. Check that hash.crc64 module can be imported (v -silent test vlib/hash/crc64/)
  3. Manual check: python3 crc64_ref.py checksum 313233343536373839 (should match C)