sha256

    MoonBit sha256: provide simple sha256 hash algorithm.

    sha256
    hash
    algorithm
    moonbit
    Download zip
    Author
    Version
    0.17.33
    License
    Apache-2.0
    Last updated
    14 days ago
    Downloads
    2K

    Dependencies

    #gmlewis/sha256

    check

    This is a simple sha256 hash algorithm based on Go's implementation: https://cs.opensource.google/go/go/+/refs/tags/go1.23.0:src/crypto/sha256/sha256.go which has the copyright notice:

    // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file.

    #Status

    The code has been updated to support compiler:

    $ moon version --all moon 0.1.20260819 (fc2a4ee 2026-08-19) ~/.moon/bin/moon moonc v0.10.9+6e6c44045 (2026-08-19) ~/.moon/bin/moonc moonrun 0.1.20260819 (fc2a4ee 2026-08-19) ~/.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

    type Digest

    Digest represents the partial evaluation of a checksum.
    impl HashFunc for Digest

    Digest::new

    fn Digest::new() -> Digest

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

    Digest::reset

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

    reset resets a digest for re-use.

    gen_hmac

    fn gen_hmac(body : Bytes, client_secret : Bytes) -> String

    gen_hmac generates a base64-encoded String representing the SHA256 signature of the provided body using the provided client_secret key.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io