src/mechanisms/digest.js
function computeHash(data) {
    const ha1 =
      data.ha1 ||
      _computeHash(
        data.algorithm,
        [data.username, data.realm, data.password].join(':'),
      );
    const ha2 = _computeHash(data.algorithm, [data.method, data.uri].join(':'));

    return _computeHash(
      data.algorithm,
      [ha1, data.nonce, data.nc, data.cnonce, data.qop, ha2].join(':'),
    );
  }
function computeHash(data) {
    const ha1 =
      data.ha1 ||
      _computeHash(
        data.algorithm,
        [data.username, data.realm, data.password].join(':'),
      );
    const ha2 = _computeHash(data.algorithm, [data.method, data.uri].join(':'));

    return _computeHash(
      data.algorithm,
      [ha1, data.nonce, data.nc, data.cnonce, data.qop, ha2].join(':'),
    );
  }
function computeHash ( data ) { const ha1 = data . ha1 || _computeHash ( data . algorithm , [ data . username , data . realm , data . password ] . join ( ':' ) , ) ; const ha2 = _computeHash ( data . algorithm , [ data . method , data . uri ] . join ( ':' ) ) ; return _computeHash ( data . algorithm , [ ha1 , data . nonce , data . nc , data . cnonce , data . qop , ha2 ] . join ( ':' ) , ) ; }
Compute the Digest authentication hash from the given credentials.
@param  {Object} data The credentials to encode and other encoding details.
@return {String}             The hash representing the credentials.
@example
assert.equal(
DIGEST.computeHash({
username: 'Mufasa',
realm: 'testrealm@host.com',
password: 'Circle Of Life',
method: 'GET',
uri: '/dir/index.html',
nonce: 'dcd98b7102dd2f0e8b11d0f600bfb0c093',
nc: '00000001',
cnonce: '0a4f113b',
qop: 'auth',
algorithm: 'md5'
}),
'6629fae49393a05397450978507c4ef1'
);
@api public
Compute the Digest authentication hash from the given credentials .