inst_crc.bend checks
raw source on the hub · import bend-osdev-crypto@0.1.0.0/inst_crc.bend as Inst_crc
CRCs as hashes: bend-osdev-crc's CRC-32 family (any Crc32Spec: widths 8 to 32) and CRC-64 family (any Crc64Spec), through its streaming interface (start, update, finish; the bitwise reference engine). A CRC is not a cryptographic hash: these instances are for checksums, and for exercising the generic algorithms (HMAC, HKDF) over a second and third hash.
The state is the register; the digest is the final value, big-endian (4 bytes for CRC-32, 8 for CRC-64; a CRC narrower than 32 bits has leading zero bytes). The block size is a parameter of HMAC only (a CRC has none); 64 is the named default. The instance for the CRC-32 of spec: ~U32, ~64n, ~4n, ~CrCrc32.init(~spec), ~CrCrc32.update(~spec), ~CrCrc32.final(~spec), ~CrCrc32.digest(~spec) with spec C.crc32.spec(), C.crc32c.spec(), ...; for CRC-64: ~W.W64, ~64n, ~8n, ~CrCrc64.init(~spec), ~CrCrc64.update(~spec), ~CrCrc64.final(~spec), ~CrCrc64.digest(~spec)
4 imports
import Base import bend-osdev-bytes@0.1.0.0/bytes.bend as B import bend-osdev-word64@0.1.0.0/word64.bend as W import bend-osdev-crc@0.1.0.0/crc.bend as C
Templates
template CrCrc32.init source · line 21 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc32Spec -> U32
template CrCrc32.update source · line 24 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc32Spec -> @c:U32 -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> U32
template CrCrc32.final source · line 27 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc32Spec -> @c:U32 -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
template CrCrc32.digest source · line 30 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc32Spec -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
template CrCrc64.init source · line 33 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc64Spec -> 0x44cf1401f78136bfc15c4c5be1cd20f0/word64.W64
template CrCrc64.update source · line 36 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc64Spec -> @c:0x44cf1401f78136bfc15c4c5be1cd20f0/word64.W64 -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x44cf1401f78136bfc15c4c5be1cd20f0/word64.W64
template CrCrc64.final source · line 39 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc64Spec -> @c:0x44cf1401f78136bfc15c4c5be1cd20f0/word64.W64 -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets
template CrCrc64.digest source · line 42 · raw
@-spec:0x7a77d751f1a239b5a366af461ab7f041/crc.Crc64Spec -> @o:0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets -> 0x9df7f91779a4a1c215bfa96cd0864601/bytes.Octets