Skip to content

Add CRC64NVME to smithy-checksums - #868

Draft
jonathan343 wants to merge 1 commit into
feat/smithy-checksumsfrom
feat/smithy-checksums-crc64nvme
Draft

jonathan343 wants to merge 1 commit into
feat/smithy-checksumsfrom
feat/smithy-checksums-crc64nvme

Conversation

@jonathan343

@jonathan343 jonathan343 commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Note

Stacked on #867, targeting feat/smithy-checksums so this PR contains only CRC64NVME.

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, 108 deselected in 0.46s

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

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").
@jonathan343
jonathan343 force-pushed the feat/smithy-checksums-crc64nvme branch from aeded0f to cfcc9f2 Compare October 25, 2026 04:59
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.

1 participant