Skip to content

Add CRC64NVME to smithy-checksums - #868

Merged
jonathan343 merged 2 commits into
developfrom
feat/smithy-checksums-crc64nvme
Oct 31, 2026
Merged

jonathan343 merged 2 commits into
developfrom
feat/smithy-checksums-crc64nvme

Conversation

@jonathan343

@jonathan343 jonathan343 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

S3 uses CRC64NVME for full-object checksums, and it's the algorithm S3 computes when an upload doesn't specify one. This PR adds it to smithy-checksums as CRC64NVME, also available through new("crc64nvme"). It reuses the native extension and the pure-Python CRC implementation from #867. The native side uses crc-fast's Crc64Nvme. The pure-Python side reuses the table-driven CRC that CRC32C uses, with the CRC-64/NVME polynomial.

Example

import base64

import smithy_checksums

checksum = smithy_checksums.new("CRC64NVME")
checksum.update(b"Hello world")
print(checksum.name, checksum.digest_size, base64.b64encode(checksum.digest()))

The native and pure-Python builds print the same thing:

crc64nvme 8 b'OOJZ0D8xKts='

Testing

The known answers are the CRC-64/NVME check value for "123456789" and the four 64-bit CRC test cases from the NVMe NVM Command Set specification. Both implementations are also compared against the CRT and against each other:

uv run pytest packages/smithy-checksums -k "crc64nvme and (known_answers or matches_crt or native_matches_pure)" --no-cov -q
6 passed, 118 deselected in 0.11s

The chunked pure-Python CRC is also checked against a bit-at-a-time reference CRC across chunk boundaries:

uv run pytest packages/smithy-checksums -k "crc64nvme and chunked_crc_matches_bitwise" --no-cov -q
1 passed, 123 deselected in 0.14s

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jonathan343
jonathan343 added this pull request to stack #869 October 25, 2026 04:26
@jonathan343
jonathan343 force-pushed the feat/smithy-checksums-crc64nvme branch from aeded0f to cfcc9f2 Compare October 25, 2026 04:59
@jonathan343
jonathan343 force-pushed the feat/smithy-checksums-crc64nvme branch from cfcc9f2 to 82838e3 Compare October 27, 2026 15:47
@jonathan343
jonathan343 force-pushed the feat/smithy-checksums-crc64nvme branch 2 times, most recently from fec00fb to eef1834 Compare October 27, 2026 21:04
Base automatically changed from feat/smithy-checksums to develop October 31, 2026 18:08
Adds CRC64NVME, the algorithm S3 uses for full-object checksums, backed by
the native extension with a pure-Python fallback, and available through
new("crc64nvme").
CRC64NVME shares the chunked big-integer path with CRC32C, which takes it
from about 15 MB/s to about 135 MB/s. Add it to the test that checks that
path against a bit-at-a-time CRC around the chunk and tail boundaries.
@jonathan343
jonathan343 force-pushed the feat/smithy-checksums-crc64nvme branch from eef1834 to 10d040d Compare October 31, 2026 18:58
@jonathan343
jonathan343 marked this pull request as ready for review October 31, 2026 19:09
@jonathan343
jonathan343 requested a review from a team as a code owner October 31, 2026 19:09

@stobrien89 stobrien89 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jonathan343
jonathan343 merged commit 319ac30 into develop Oct 31, 2026
27 checks passed
@jonathan343
jonathan343 deleted the feat/smithy-checksums-crc64nvme branch October 31, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants