moonbitstack/mooncrypt/sum/crc32 does not have a README file

    Crc32

    pub struct Crc32 {
    kind : Kind
    table : FixedArray[UInt]
    state : UInt
    }

    A CRC-32 in progress.

    The running value is kept complemented, as the reference implementation does, so the final xor is one operation at the end rather than a correction at every step.
    impl Hash for Crc32

    Crc32::block

    fn Crc32::block(self : Crc32) -> Int

    Crc32::finish

    fn Crc32::finish(self : Crc32) -> Bytes

    Crc32::new

    fn Crc32::new(kind? : Kind) -> Crc32

    Start a CRC-32. The default is the IEEE polynomial, which is what "CRC-32" means when nothing else is said.

    Crc32::reset

    fn Crc32::reset(self : Crc32) -> Unit

    Crc32::size

    fn Crc32::size(self : Crc32) -> Int

    Crc32::update

    fn Crc32::update(self : Crc32, data : BytesView) -> Unit

    Feed more bytes.

    Crc32::value

    fn Crc32::value(self : Crc32) -> UInt

    The checksum of everything fed so far, as the number the formats that write it actually store.

    Crc32::write

    fn Crc32::write(self : Crc32, data : BytesView) -> Unit

    Kind

    pub(all) enum Kind {
    Ieee
    Castagnoli
    } derive(Eq,
    Debug
    )

    Which CRC-32.

    The two differ only in the polynomial, but they detect different faults: the IEEE one is the one on Ethernet and in zip files, and the Castagnoli one has better distance properties for the short blocks a filesystem or a storage protocol writes.

    Kind::block

    fn Kind::block(self : Kind) -> Int

    One byte at a time: that is the stride this machine works in, and it is what [@spec.Hash::block] reports.

    Kind::equal

    fn Kind::equal(Kind, Kind) -> Bool

    Kind::not_equal

    fn Kind::not_equal(x : Kind, y : Kind) -> Bool

    Kind::size

    fn Kind::size(self : Kind) -> Int

    The checksum length in bytes.

    Kind::to_repr

    crc32

    fn crc32(data : BytesView, kind? : Kind) -> UInt

    The CRC-32 of a whole message.

    Source Files

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io