docs: 统一许可证说明为 MIT
基于 RFC 2104 的 HMAC-SHA256 MoonBit 实现。
hmac-mbt 使用 SHA-256 作为底层哈希函数,实现了 RFC 2104 定义的 HMAC 消息认证码。
hmac-mbt
Bytes
pub fn hmac_sha256(key : Bytes, message : Bytes) -> Bytes pub fn hmac_sha256_hex(key : Bytes, message : Bytes) -> String pub fn verify(key : Bytes, message : Bytes, tag : Bytes) -> Bool pub fn constant_time_equal(left : Bytes, right : Bytes) -> Bool pub fn to_hex(input : Bytes) -> String
test { let tag = hmac_sha256_hex( b"key", b"The quick brown fox jumps over the lazy dog", ) inspect( tag, content="f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8", ) }
moon check moon test
当前仅支持 HMAC-SHA256,暂不提供泛型多算法 HMAC 接口或流式增量输入 API。
hmac.new(key, message, hashlib.sha256)
MIT
本仓库的 HMAC 构造由 hmac-mbt 实现,SHA-256 摘要计算由 MoonBit 包 gmlewis/sha256 提供。
gmlewis/sha256
HMAC-SHA256 MoonBit 实现 — 基于 RFC 2104 的 HMAC-SHA256 MoonBit 库,支持常量时间比较、十六进制输出。适用于 API 签名、Webhook 验证、消息认证等场景。
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
hmac-mbt
基于 RFC 2104 的 HMAC-SHA256 MoonBit 实现。
hmac-mbt使用 SHA-256 作为底层哈希函数,实现了 RFC 2104 定义的 HMAC 消息认证码。功能
Bytes格式)API
示例
本地验证
项目范围
当前仅支持 HMAC-SHA256,暂不提供泛型多算法 HMAC 接口或流式增量输入 API。
参考
hmac.new(key, message, hashlib.sha256)许可
MIT
本仓库的 HMAC 构造由
hmac-mbt实现,SHA-256 摘要计算由 MoonBit 包gmlewis/sha256提供。