subtle.digest(algorithm, data)
-
algorithm
:<string> | <AlgorithmIdentifier> -
data
:<ArrayBuffer> | <TypedArray> | <DataView> | <Buffer> -
返回:<Promise> 成功后使用 <ArrayBuffer> 完成。
¥Returns: <Promise> Fulfills with an <ArrayBuffer> upon success.
使用 algorithm
标识的方法,subtle.digest()
尝试生成 data
的摘要。如果成功,返回的 promise 将使用包含计算摘要的 <ArrayBuffer> 进行解析。
¥Using the method identified by algorithm
, subtle.digest()
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:
-
'SHA-1'
-
'SHA-256'
-
'SHA-384'
-
'SHA-512'
如果 algorithm
作为 <Object> 提供,则它必须具有值为上述之一的 name
属性。
¥If algorithm
is provided as an <Object>, it must have a name
property
whose value is one of the above.