doc: add note about timingSafeEqual for TypedArray#36323
doc: add note about timingSafeEqual for TypedArray#36323tniessen wants to merge 2 commits intonodejs:masterfrom
Conversation
doc/api/crypto.md
Outdated
| must have the same byte length. | ||
|
|
||
| If at least one of `a` and `b` is a `TypedArray`, the result may depend on | ||
| the platform byte order. |
There was a problem hiding this comment.
may depend sounds like this isn’t deterministic, but I assume it is? It’s always going to depend on the platform byte order, right?
There was a problem hiding this comment.
Good point! My thinking was that the result of some inputs (e.g., timingSafeEqual(new Uint8Array([1, 1]), new Uint16Array([0x0101]))) does not depend on the platform byte order, but that's probably not what others would take away from the way I worded it.
There was a problem hiding this comment.
Yeah, I see … maybe I would say something like If at least one of `a` and `b` is a `TypedArray` with more than one byte per entry, like `Uint16Array`, the result will be computed using platform byte order?
There was a problem hiding this comment.
Sorry about the delay, fixed!
Trott
left a comment
There was a problem hiding this comment.
LGTM with the elimination of may from the text.
PR-URL: #36323 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
|
Landed in 6255973, thank you for reviewing! |
PR-URL: #36323 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
PR-URL: #36323 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Since #29657,
timingSafeEqualusesbyteLengthinstead oflength. When comparing different types (e.g.,Uint8ArrayandUint16Array), the result can depend on the byte order of the system architecture.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes