构造函数
方法
update
-
update(data: string | Uint8Array<ArrayBufferLike>): this
参数
- data: string | Uint8Array<ArrayBufferLike>
返回 this
当前实例(便于链式调用)
静态digest
-
digest(data: string | Uint8Array<ArrayBufferLike>, options?: SM3Options): string
参数
- data: string | Uint8Array<ArrayBufferLike>
可选options: SM3Options
返回 string
哈希摘要(默认返回十六进制字符串)
静态hmac
-
hmac( key: string | Uint8Array<ArrayBufferLike>, data: string | Uint8Array<ArrayBufferLike>, options?: SM3Options,): string
参数
- key: string | Uint8Array<ArrayBufferLike>
- data: string | Uint8Array<ArrayBufferLike>
可选options: SM3Options
返回 string
HMAC 值(默认返回十六进制字符串)
SM3 哈希算法的面向对象封装
SM3 是中国国家密码管理局发布的密码杂凑算法, 输出长度为 256 位(32 字节)。
支持两种使用方式:
示例