subtle.digest(algorithm, data)
版本历史
| 版本 | 变更 |
|---|---|
| v25.9.0 | TurboSHAKE and KangarooTwelve algorithms are now supported. |
| v24.7.0 | SHA-3 algorithms are now supported. |
| v24.7.0 | SHAKE algorithms are now supported. |
| v15.0.0 | 新增于: v15.0.0 |
algorithm<string>data<ArrayBuffer> | <TypedArray> | <DataView> | <Buffer>- 返回:<Promise> 成功时会触发一个 <ArrayBuffer>。
使用由 algorithm 指定的方法,该方法尝试生成 data 的摘要。如果成功,返回的 Promise 将被解决,并返回包含计算出摘要的 <ArrayBuffer>。
🌐 Using the method identified by algorithm, this method attempts to
generate a digest of data. If successful, the returned promise is resolved
with an <ArrayBuffer> containing the computed digest.
如果 algorithm 被提供为 <string>,它必须是以下之一:
🌐 If algorithm is provided as a <string>, it must be one of:
'cSHAKE128'[^现代算法]'cSHAKE256'[^现代算法]'KT128'4'KT256'4'SHA-1''SHA-256''SHA-384''SHA-512''SHA3-256'[^现代算法]'SHA3-384'[^现代算法]'SHA3-512'[^现代算法]'TurboSHAKE128'4'TurboSHAKE256'4
如果 algorithm 作为 <Object> 提供,它必须有一个 name 属性,其值必须是上述之一。
🌐 If algorithm is provided as an <Object>, it must have a name property
whose value is one of the above.