Documentation ¶
Index ¶
- Constants
- Variables
- func Checksum(data []byte, params Params) uint32
- func ChecksumBZIP2(data []byte) uint32
- func ChecksumCKSUM(data []byte) uint32
- func ChecksumCRC32(data []byte) uint32
- func ChecksumCRC32A(data []byte) uint32
- func ChecksumCRC32C(data []byte) uint32
- func ChecksumCRC32D(data []byte) uint32
- func ChecksumCRC32Q(data []byte) uint32
- func ChecksumCastagnoli(data []byte) uint32
- func ChecksumIEEE(data []byte) uint32
- func ChecksumJAMCRC(data []byte) uint32
- func ChecksumKoopman(data []byte) uint32
- func ChecksumMPEG_2(data []byte) uint32
- func ChecksumPOSIX(data []byte) uint32
- func ChecksumXFER(data []byte) uint32
- func ToBinString(data uint32) string
- func ToHexString(data uint32) string
- func ToReverseHexBinString(data uint32) string
- func ToReverseHexString(data uint32) string
- type CRC
- func (this *CRC) Checksum(data []byte) uint32
- func (this *CRC) Complete(crc uint32) uint32
- func (this *CRC) GetParams() Params
- func (this *CRC) GetTable() [256]uint32
- func (this *CRC) Init() uint32
- func (this *CRC) MakeTable() *CRC
- func (this *CRC) Update(crc uint32, data []byte) uint32
- func (this *CRC) WithParams(params Params) *CRC
- func (this *CRC) WithTable(table [256]uint32) *CRC
- type Hash32
- type Params
Constants ¶
View Source
const Size = 4
大小
Variables ¶
View Source
var ( // "CRC-32" x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 CRC32 = Params{0x04C11DB7, 0xFFFFFFFF, true, true, 0xFFFFFFFF} // "CRC-32/MPEG-2" x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 CRC32_MPEG_2 = Params{0x04C11DB7, 0xFFFFFFFF, false, false, 0x00000000} // "CRC-32/BZIP2" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_BZIP2 = Params{0x04C11DB7, 0xFFFFFFFF, false, false, 0xFFFFFFFF} // "CRC-32/POSIX" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_POSIX = Params{0x04C11DB7, 0x00000000, false, false, 0xFFFFFFFF} // "CRC-32/CKSUM" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_CKSUM = CRC32_POSIX // "CRC-32/JAMCRC" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_JAMCRC = Params{0x04C11DB7, 0xFFFFFFFF, true, true, 0x00000000} // "CRC-32/CRC32A" (ITU I.363.5 algorithm, popularized by BZIP2) checksum. // X32+X26+X23+X22+X16+X12+X11+X10+X8+X7+X5+X4+X2+X+1 CRC32_CRC32A = CRC32_BZIP2 // "CRC-32/IEEE" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_IEEE = CRC32 // "CRC-32/Castagnoli" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_Castagnoli = Params{0x1EDC6F41, 0xFFFFFFFF, true, true, 0xFFFFFFFF} // "CRC-32/CRC32C" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_CRC32C = CRC32_Castagnoli // "CRC-32/Koopman" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_Koopman = Params{0x741B8CD7, 0xFFFFFFFF, true, true, 0xFFFFFFFF} // "CRC-32/XFER" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_XFER = Params{0x000000AF, 0x00000000, false, false, 0x00000000} // "CRC-32/CRC32Q" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_CRC32Q = Params{0x814141AB, 0x00000000, false, false, 0x00000000} // "CRC-32/CRC32D" x32+x26+x23+x22+x16+x12+x11+x10+x8+x7+x5+x4+x2+x+1 CRC32_CRC32D = Params{0xA833982B, 0xFFFFFFFF, true, true, 0xFFFFFFFF} )
类型列表
Functions ¶
func ChecksumCastagnoli ¶ added in v1.0.10002
生成 Castagnoli
Types ¶
type CRC ¶ added in v1.0.10006
type CRC struct {
// contains filtered or unexported fields
}
表格
type Params ¶
type Params struct { // 生成项的简写,以16进制表示。 // 例如:CRC-32 即是0x04C11DB7, // 忽略了最高位的"1",即完整的生成项是0x104C11DB7。 Poly uint32 // 这是算法开始时寄存器(crc)的初始化预置值,十六进制表示。 Init uint32 // 待测数据的每个字节是否按位反转,True或False。 RefIn bool // 在计算后之后,异或输出之前,整个数据是否按位反转,True或False。 RefOut bool // 计算结果与此参数异或后得到最终的CRC值。 XorOut uint32 }
参数 NAME:参数模型名称。 WIDTH:宽度,即CRC比特数。位数为:32
Click to show internal directories.
Click to hide internal directories.