diff --git a/lib/client.js b/lib/client.js index 3e393e50..e6f860ad 100644 --- a/lib/client.js +++ b/lib/client.js @@ -273,14 +273,10 @@ class Client extends EventEmitter { let hostVerifier; if (typeof cfg.hostVerifier === 'function') { const hashCb = cfg.hostVerifier; - let hasher; - if (HASHES.indexOf(cfg.hostHash) !== -1) { - // Default to old behavior of hashing on user's behalf - hasher = createHash(cfg.hostHash); - } hostVerifier = (key, verify) => { - if (hasher) { - hasher.update(key); + if (HASHES.indexOf(cfg.hostHash) !== -1) { + // Default to old behavior of hashing on user's behalf + const hasher = createHash(cfg.hostHash).update(key); key = hasher.digest('hex'); } const ret = hashCb(key, verify);