crc32

MoonBit crc32: provide simple crc32 hash algorithm.

crc32
hash
algorithm
moonbit
moon add gmlewis/crc32@0.8.17
Download zip
Author
Version
0.8.17
License
Apache-2.0
Last updated
2 months ago
Downloads
5K
README

#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.20260522 (84aa893 2026-05-22) ~/.moon/bin/moon moonc v0.9.3+3d4544a9e (2026-05-22) ~/.moon/bin/moonc moonrun 0.1.20260522 (84aa893 2026-05-22) ~/.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