2 ms·
You can use a hash where the supplier of inputKey is not able to know the hash value. E.g., function checkApiKey(inputKey, correctKey) { r = randomStrin
by tzs 3y ago
You can use a hash where the supplier of inputKey is not able to know the hash value. E.g.,
function checkApiKey(inputKey, correctKey) {
r = randomString()
inputHash = hash(r + inputKey)
correctHash = hash(r + correctKey)
if (inputHash !== correctHash) {
throw new Error("wrong key");
}
}