-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmp.d.ts
20 lines (20 loc) · 873 Bytes
/
cmp.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/// <reference types="node" />
/**
* Constant-Time Buffer Compare
* ============================
*
* A constant-time comparison function. This should be used in any security
* sensitive code where leaking timing information may lead to lessened
* security. Note that if the buffers are not equal in length, this function
* loops for the longest buffer, which may not be necessary. Usually this
* function should be used for buffers that would otherwise be equal length,
* such as a hash, particularly Hmacs.
*
* The algorithm here, which is XORs each byte (or, if undefined, 0) with the
* corresponding other byte, and then ORs that with a running total (d), is
* adapted from here:
*
* https://groups.google.com/forum/#!topic/keyczar-discuss/VXHsoJSLKhM
*/
export declare function cmp(buf1: Buffer, buf2: Buffer): boolean;
//# sourceMappingURL=cmp.d.ts.map