* Compares two strings of the same length in constant time. * @param {string} known Must be of the correct length * @param {string} unknown Must be the same length as `known` * @returns {boolean} * @inner
(known, unknown)
| 209 | * @inner |
| 210 | */ |
| 211 | function safeStringCompare(known, unknown) { |
| 212 | var diff = known.length ^ unknown.length; |
| 213 | for (var i = 0; i < known.length; ++i) { |
| 214 | diff |= known.charCodeAt(i) ^ unknown.charCodeAt(i); |
| 215 | } |
| 216 | return diff === 0; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Synchronously tests a password against a hash. |
no outgoing calls
no test coverage detected