CoolrfulDARkness/moontlcp/crypto/sm3 does not have a README file

    Sm3

    pub struct Sm3 {
    state : FixedArray[UInt]
    block : FixedArray[Byte]
    block_len : Int
    total_len : UInt64
    }

    Streaming SM3 hash state.

    Sm3::clone

    fn Sm3::clone(self : Sm3) -> Sm3

    Clones the current SM3 state (useful for rolling TLCP handshake transcript).

    Sm3::finalize

    fn Sm3::finalize(self : Sm3) -> Bytes

    Finalizes a copy of the state and returns the 32-byte digest without mutating self.

    Sm3::new

    fn Sm3::new() -> Sm3

    Creates a fresh SM3 hasher initialized with the GB/T 32905 IV.

    Sm3::reset

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

    Resets the SM3 hasher back to the initial GB/T 32905 IV.

    Sm3::update

    fn Sm3::update(self : Sm3, data : Bytes) -> Unit

    Feeds Bytes into the SM3 hasher.

    Sm3::update_byte

    fn Sm3::update_byte(self : Sm3, b : Byte) -> Unit

    Feeds a single byte into the SM3 hasher.

    Sm3::update_view

    fn Sm3::update_view(self : Sm3, data : BytesView) -> Unit

    Feeds a BytesView chunk into the SM3 hasher.

    SM3_BLOCK_SIZE

    let SM3_BLOCK_SIZE : Int

    SM3_DIGEST_SIZE

    let SM3_DIGEST_SIZE : Int

    hmac_sm3

    fn hmac_sm3(key : Bytes, data : Bytes) -> Bytes

    RFC 2104 HMAC-SM3 (block size 64 bytes, output 32 bytes).

    hmac_sm3_parts

    fn hmac_sm3_parts(key : Bytes, parts : Array[BytesView]) -> Bytes

    HMAC-SM3 over multiple chunks (avoids extra concatenation allocations).

    kdf_sm3

    fn kdf_sm3(z : Bytes, klen : Int) -> Bytes

    GB/T 32918.4 SM2 Key Derivation Function (KDF) using SM3.

    sm3

    fn sm3(data : Bytes) -> Bytes

    One-shot SM3 hash over Bytes.

    sm3_view

    fn sm3_view(data : BytesView) -> Bytes

    One-shot SM3 hash over BytesView.

    tlcp_prf

    fn tlcp_prf(secret : Bytes, label : Bytes, seed : Bytes, out_len : Int) -> Bytes

    GM/T 0024-2023 §6.3 TLCP PRF using P_SM3: PRF(secret, label, seed) = P_SM3(secret, label + seed)

    Source Files