diff --git a/lib/http/base.js b/lib/http/base.js index f81d6a67..4797be1a 100644 --- a/lib/http/base.js +++ b/lib/http/base.js @@ -191,13 +191,13 @@ HTTPBase.prototype.basicAuth = function basicAuth(options) { assert(typeof user === 'string'); assert(user.length <= 255, 'Username too long.'); assert(util.isAscii(user), 'Username must be ASCII.'); - user = digest.hash256(user); + user = digest.hash256(Buffer.from(user, 'ascii')); } assert(typeof pass === 'string'); assert(pass.length <= 255, 'Password too long.'); assert(util.isAscii(pass), 'Password must be ASCII.'); - pass = digest.hash256(pass); + pass = digest.hash256(Buffer.from(pass, 'ascii')); if (!realm) realm = 'server';