hash::crc64
Implements the CRC-64 checksum algorithm. It is a non-cryptographic checksum.
Index
Types
type state = struct {
hash::hash,
table: *[256]u64,
cval: u64,
};
Constants
def ECMA: u64 = 14514072000185962306;
def ISO: u64 = 15564440312192434176;
def SZ: size = 8;
Globals
const ecma_table: [256]u64;
const iso_table: [256]u64;
Functions
fn crc64(table: *[256]u64) state;
fn memoize(polynomial: u64, buf: *[256]u64) void;
fn sum64(h: *hash::hash) u64;
Types
type state
Show undocumented member
type state = struct {
hash::hash,
table: *[256]u64,
cval: u64,
};
Constants
def ECMA
def ECMA: u64 = 14514072000185962306;
ECMA polynomial for CRC-64. Used in ECMA-182 and xz-utils.
def ISO
def ISO: u64 = 15564440312192434176;
ISO polynomial for CRC-64. Used in ISO 3309 (high-level data link controls).
def SZ
def SZ: size = 8;
The size, in bytes, of a CRC-64 checksum.
Globals
let ecma_table
const ecma_table: [256]u64;
Table of memoized values for each byte with the ECMA polynomial.
let iso_table
const iso_table: [256]u64;
Table of memoized values for each byte with the ISO polynomial.
Functions
fn crc64
fn crc64(table: *[256]u64) state;
Creates a hash::hash which computes the CRC-64 algorithm. This hash function does not allocate any state, so you do not need to call hash::close when you are done with it.
It takes a table of memoized values for a given polynomail (for example, iso_table or ecma_table); a table for a custom polynomial, populated by memoize function, may also be used.
fn memoize
fn memoize(polynomial: u64, buf: *[256]u64) void;
Populate a user-provided buffer with the memoized values for a custom polynomial.
The user-provided polynomial must be in the reversed form.
fn sum64
fn sum64(h: *hash::hash) u64;
Returns the 64-bit computed CRC.