checksum

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMismatch = errors.New("checksum mismatch error")

ErrMismatch indicates a checksum verification failure due to a derived checksum not being equal to expected checksum

Functions

func Verify

func Verify(
	payload codec.ThriftObject,
	checksum Checksum,
) error

Verify verifies that the checksum generated from the given thrift object matches the specified expected checksum Return ErrMismatch when checksums mismatch

Types

type Checksum

type Checksum struct {
	// Version represents version of the payload from
	Version int
	// which this checksum was derived
	Flavor Flavor
	// Value is the checksum value
	Value []byte
}

Checksum represents a checksum value along with associated metadata

func GenerateCRC32

func GenerateCRC32(
	payload codec.ThriftObject,
	payloadVersion int,
) (Checksum, error)

GenerateCRC32 generates an IEEE crc32 checksum on the serilized byte array of the given thrift object. The serialization proto used will be of type thriftRW

type Flavor

type Flavor int

Flavor is an enum type that represents the type of checksum

const (
	// FlavorUnknown represents an unknown/uninitialized checksum flavor
	FlavorUnknown Flavor = iota
	// FlavorIEEECRC32OverThriftBinary represents crc32 checksum generated over thriftRW serialized payload
	FlavorIEEECRC32OverThriftBinary
)

func (Flavor) IsValid

func (f Flavor) IsValid() bool

IsValid returns true if the checksum flavor is valid

Jump to

Keyboard shortcuts

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