crypto.timingSafeEqual(a, b)
a
{Buffer | TypedArray | DataView}b
{Buffer | TypedArray | DataView}- Returns: {boolean}
This function is based on a constant-time algorithm.
Returns true if a
is equal to b
, without leaking timing information that
would allow an attacker to guess one of the values. This is suitable for
comparing HMAC digests or secret values like authentication cookies or
capability urls.
a
and b
must both be Buffer
s, TypedArray
s, or DataView
s, and they
must have the same length.
Use of crypto.timingSafeEqual
does not guarantee that the surrounding code
is timing-safe. Care should be taken to ensure that the surrounding code does
not introduce timing vulnerabilities.
Feedback
Was this page helpful?
很高兴听到! 请告诉我们,我们如何才能改善.
很遗憾听到这个消息。 请告诉我们,我们如何才能改善.
最后修改 April 16, 2020: 加密 (a75e592)