@@ -5443,8 +5443,11 @@ changes:
5443
5443
* ` b ` {ArrayBuffer|Buffer|TypedArray|DataView}
5444
5444
* Returns: {boolean}
5445
5445
5446
- This function is based on a constant-time algorithm.
5447
- Returns true if ` a ` is equal to ` b ` , without leaking timing information that
5446
+ This function compares the underlying bytes that represent the given
5447
+ ` ArrayBuffer ` , ` TypedArray ` , or ` DataView ` instances using a constant-time
5448
+ algorithm.
5449
+
5450
+ It returns true if ` a ` is equal to ` b ` , without leaking timing information that
5448
5451
would allow an attacker to guess one of the values. This is suitable for
5449
5452
comparing HMAC digests or secret values like authentication cookies or
5450
5453
[ capability urls] ( https://www.w3.org/TR/capability-urls/ ) .
@@ -5453,6 +5456,15 @@ comparing HMAC digests or secret values like authentication cookies or
5453
5456
must have the same byte length. An error is thrown if ` a ` and ` b ` have
5454
5457
different byte lengths.
5455
5458
5459
+ This function does not compare the elements of ` a ` and ` b ` directly. Instead, it
5460
+ compares the bitwise representations of ` a ` and ` b ` . If ` a ` and ` b ` are
5461
+ instances of the same ` TypedArray ` class, this is equivalent to an element-wise
5462
+ [ SameValue comparison] [ ] .
5463
+
5464
+ <strong class =" critical " >In particular, this function does not follow the usual
5465
+ definition of equality for floating-point numbers when ` a ` or ` b ` is a
5466
+ ` Float32Array ` or a ` Float64Array ` .</strong >
5467
+
5456
5468
If at least one of ` a ` and ` b ` is a ` TypedArray ` with more than one byte per
5457
5469
entry, such as ` Uint16Array ` , the result will be computed using the platform
5458
5470
byte order.
@@ -6104,6 +6116,7 @@ See the [list of SSL OP Flags][] for details.
6104
6116
[ RFC 4122 ] : https://www.rfc-editor.org/rfc/rfc4122.txt
6105
6117
[ RFC 5208 ] : https://www.rfc-editor.org/rfc/rfc5208.txt
6106
6118
[ RFC 5280 ] : https://www.rfc-editor.org/rfc/rfc5280.txt
6119
+ [ SameValue comparison ] : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness
6107
6120
[ Web Crypto API documentation ] : webcrypto.md
6108
6121
[ `BN_is_prime_ex` ] : https://www.openssl.org/docs/man1.1.1/man3/BN_is_prime_ex.html
6109
6122
[ `Buffer` ] : buffer.md
0 commit comments