crc24

package module
v0.0.0-...-8aeda6b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 1 Imported by: 2

README

GoDoc

About

crc24 checksum, as used by OpenPGP checksum as specified in RFC 4880, section 6.1

  • Supports io.Writer streaming interface
  • Follows the example of hash, hash/crc32 and hash/crc64.

Originally extracted from https://github.com/golang/crypto/blob/4ba4fb4dd9e7f7ed9053fb45482e9a725c7e3fb4/openpgp/armor/armor.go#L48

License

Under MIT

Documentation

Overview

Package crc24 implements the 24-bit cyclic redundancy check, or CRC-24, checksum. See http://en.wikipedia.org/wiki/Cyclic_redundancy_check for information.

Index

Constants

View Source
const Size = 3

The size of a CRC-24 checksum in bytes.

Variables

This section is empty.

Functions

func ChecksumOpenPGP

func ChecksumOpenPGP(p []byte) uint32

ChecksumOpenPGP calculates the openPGP-24 as used by OpenPGP

func Update

func Update(crc uint32, d []byte) uint32

Update returns the result of adding the bytes in p to the openPGP. It is compatible with OpenPGP checksum as specified in RFC 4880, section 6.1 (https://tools.ietf.org/html/rfc4880#section-6.1).

Types

type Hash24

type Hash24 interface {
	hash.Hash
	Sum24() uint32
}

Hash24 is the common interface for a 24-bit hash function.

func New

func New() Hash24

New creates a new Hash24 computing the CRC-24 checksum.

Jump to

Keyboard shortcuts

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