mb-hmac

    HMAC message authentication for MoonBit (HMAC-SHA256, HMAC-SHA512; native+WASM)

    crypto
    mac
    hmac
    hmac-sha256
    hmac-sha512
    Download zip
    Author
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    6 months ago
    Downloads
    210

    #MB Crypto Mac Library

    A cryptographic MAC (Message Authentication Code) library for secure message authentication.

    #Features

    • Secure message authentication
    • Multiple MAC algorithm support
    • Easy-to-use API
    • Cross-platform compatibility

    #Installation

    # Add installation instructions here

    #Usage

    // Generate MAC
    let mac = @hmac.generateMAC(message, key);

    // Verify MAC
    let isValid = @hmac.verifyMAC(message, key, mac);

    #API Reference

    #generateMAC(message, key)

    Generates a MAC for the given message using the provided key.

    #verifyMAC(message, key, mac)

    Verifies a MAC against the message and key.

    #License

    MIT License

    #Contributing

    Pull requests are welcome. For major changes, please open an issue first.

    generateMAC

    fn generateMAC(message : Array[UInt], key : Array[UInt]) -> FixedArray[UInt]

    generateMAC_bytes

    fn generateMAC_bytes(message : Bytes, key : Bytes) -> FixedArray[UInt]

    generateMAC_string

    fn generateMAC_string(message : String, key : String) -> FixedArray[UInt]

    hmac_sha256

    fn hmac_sha256(message : Array[UInt], key : Array[UInt]) -> FixedArray[UInt]

    hmac_sha256_bytes

    fn hmac_sha256_bytes(message : Bytes, key : Bytes) -> FixedArray[UInt]

    hmac_sha256_string

    fn hmac_sha256_string(message : String, key : String) -> FixedArray[UInt]

    hmac_sha512

    fn hmac_sha512(message : Array[UInt], key : Array[UInt]) -> FixedArray[UInt]

    hmac_sha512_bytes

    fn hmac_sha512_bytes(message : Bytes, key : Bytes) -> FixedArray[UInt]

    hmac_sha512_string

    fn hmac_sha512_string(message : String, key : String) -> FixedArray[UInt]

    verifyMAC

    fn verifyMAC(message : Array[UInt], key : Array[UInt], mac : Array[UInt]) -> Bool

    verifyMAC_bytes

    fn verifyMAC_bytes(message : Bytes, key : Bytes, mac : Array[UInt]) -> Bool

    verifyMAC_string

    fn verifyMAC_string(message : String, key : String, mac : Array[UInt]) -> Bool

    verify_hmac_sha256

    fn verify_hmac_sha256(message : Array[UInt], key : Array[UInt], mac : Array[UInt]) -> Bool

    verify_hmac_sha256_bytes

    fn verify_hmac_sha256_bytes(message : Bytes, key : Bytes, mac : Array[UInt]) -> Bool

    verify_hmac_sha512

    fn verify_hmac_sha512(message : Array[UInt], key : Array[UInt], mac : Array[UInt]) -> Bool

    verify_hmac_sha512_bytes

    fn verify_hmac_sha512_bytes(message : Bytes, key : Bytes, mac : Array[UInt]) -> Bool

    Source Files