crc64nvme

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 6 Imported by: 16

README

crc64nvme

This Golang package calculates CRC64 checksums using carryless-multiplication accelerated with SIMD instructions for both ARM and x86. It is based on the NVME polynomial as specified in the NVM Express® NVM Command Set Specification.

The code is based on the crc64fast-nvme package in Rust and is released under the Apache 2.0 license.

For more background on the exact technique used, see this Fast CRC Computation for Generic Polynomials Using PCLMULQDQ Instruction paper.

Performance

To follow.

Requirements

All Go versions >= 1.22 are supported.

Contributing

Contributions are welcome, please send PRs for any enhancements.

Documentation

Overview

Package crc64nvme implements the 64-bit cyclic redundancy check with NVME polynomial.

Index

Constants

View Source
const (
	// The size of a CRC-64 checksum in bytes.
	Size = 8

	// The NVME polynoimial (reversed, as used by Go)
	NVME = 0x9a6c9329ac4bc9b5
)

Variables

This section is empty.

Functions

func Checksum

func Checksum(data []byte) uint64

Checksum returns the CRC-64 checksum of data using the NVME polynomial.

func New

func New() hash.Hash64

New creates a new hash.Hash64 computing the CRC-64 checksum using the NVME polynomial. Its Sum method will lay the value out in big-endian byte order. The returned Hash64 also implements encoding.BinaryMarshaler and encoding.BinaryUnmarshaler to marshal and unmarshal the internal state of the hash.

func Update

func Update(crc uint64, p []byte) uint64

Update returns the result of adding the bytes in p to the crc.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL