Package Exports
- secure-compare-native
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (secure-compare-native) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
secure-compare-native
Constant-time safe comparison using Node.js native crypto.timingSafeEqual.
Installation
npm install secure-compare-nativeUsage
Strings:
const { secureCompare } = require("secure-compare-native");
secureCompare("abc", "abc"); // true
secureCompare("hello", "abc"); // falseBuffers:
const { secureCompareBuffer } = require("secure-compare-native");
const buff1 = Buffer.from("abc");
const buff2 = Buffer.from("hello");
secureCompareBuffer(buff1, buff1); // true
secureCompareBuffer(buff2, buff1); // falsePerformance
secureCompareis about twice slower than secure-compare on Node v12.secureCompareBufferis fast when you compare buffers.
License
MIT.