News for hackers. Stuff that matters.
Re:A beginner's guide to constant-time cryptography (2017) by tzs on Thursday February 22, 2024 @11:24AM (#39469380)
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");
    }
  }

There are no comments on this comment yet.