crc64

package
v1.21.10 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package crc64は64ビットの巡回冗長検査(CRC-64)チェックサムを実装しています。 詳細はhttps://en.wikipedia.org/wiki/Cyclic_redundancy_checkを参照してください。

Index

Constants

View Source
const (
	// ISO 3309で定義され、HDLCで使用されるISOポリノミアル。
	ISO = 0xD800000000000000

	// ECMA 182で定義されたECMA多項式。
	ECMA = 0xC96C5795D7870F42
)

事前定義された多項式。

View Source
const Size = 8

CRC-64のチェックサムのバイト単位のサイズ。

Variables

This section is empty.

Functions

func Checksum

func Checksum(data []byte, tab *Table) uint64

Checksum 関数は、Table が表す多項式を使って、データの CRC-64 チェックサムを返します。

func New

func New(tab *Table) hash.Hash64

NewはTableで表される多項式を使用してCRC-64チェックサムを計算する新しいhash.Hash64を作成します。Sumメソッドは値をビッグエンディアンのバイト順で並べます。返されるHash64は、内部状態をmarshalおよびunmarshalするためのencoding.BinaryMarshalerおよびencoding.BinaryUnmarshalerも実装しています。

func Update

func Update(crc uint64, tab *Table, p []byte) uint64

Updateはpのバイトをcrcに追加した結果を返します。

Types

type Table

type Table [256]uint64

Table は効率的な処理のための多項式を表す256単語のテーブルです。

func MakeTable

func MakeTable(poly uint64) *Table

MakeTable は指定された多項式から構築されたTableを返します。 このTableの内容は変更してはなりません。

Jump to

Keyboard shortcuts

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