crc32

MoonBit crc32: provide simple crc32 hash algorithm.

crc32
hash
algorithm
moonbit
Download zip
Author
Version
0.8.18
License
Apache-2.0
Last updated
18 hours ago
Downloads
5K

#gmlewis/crc32

check

This is a simple crc32 hash algorithm based on the Go Rosetta Stone implementation found here: https://rosettacode.org/wiki/CRC-32 which has the copyright notice:

Content is available under GNU Free Document License 1.3 unless otherwise noted.

#Status

The code has been updated to support compiler:

$ moon version --all moon 0.1.20260827 (d0aaa07 2026-08-27) ~/.moon/bin/moon moonc v0.10.11+8f8e8db1e (2026-08-27) ~/.moon/bin/moonc moonrun 0.1.20260827 (d0aaa07 2026-08-27) ~/.moon/bin/moonrun

HashFunc

pub(open) trait HashFunc {
fn name(Self) -> String
fn write(Self, Byte) -> Unit
fn check_sum(Self) -> String
}

HashFunc represents a hash algorithm like @crc32, @md5, or @sha256.

Digest

pub(all) struct Digest {
crc : UInt
name : String
}

@crc32.Digest implements the 32-bit cyclic redundancy check, or CRC-32, checksum. See https://en.wikipedia.org/wiki/Cyclic_redundancy_check for information. This package is based on the Go Rosetta Stone implementation found here: https://rosettacode.org/wiki/CRC-32
impl HashFunc for Digest

Digest::digest

fn Digest::digest(self : Digest) -> UInt

digest returns the final crc32 as a UInt.

Digest::new

fn Digest::new() -> Digest

Digest::new returns a new, reset Digest, ready to sum.

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io