Closed mofelee closed 8 years ago
// chrome request header // Authorization: Digest username="aaa", realm="UTT", nonce="b2c3cd0e094b4a7e48a42efa0505e6e0", uri="/", algorithm=MD5, response="899640e29a53ea40f96940bda6686487", opaque="5ccc069c403ebaf9f0171e9517f40e41", qop=auth, nc=00000001, cnonce="4688e752b2a56392" var ha1 = digest.calculateHA1({ user: 'aaa', realm: 'UTT', password: 'bbb' }); var response = digest.calculateDigest({ ha1: ha1, nonce: 'b2c3cd0e094b4a7e48a42efa0505e6e0', nc: 00000001, // < ----- when nc is number cnonce: '4688e752b2a56392', qop: 'auth', method: 'GET', uri: '/' }) console.log(response); // 351e522f103af77496f34467107f3c56 response = digest.calculateDigest({ ha1: ha1, nonce: 'b2c3cd0e094b4a7e48a42efa0505e6e0', nc: '00000001', // < ----- when nc is string cnonce: '4688e752b2a56392', qop: 'auth', method: 'GET', uri: '/' }) console.log(response); // 899640e29a53ea40f96940bda6686487
i suggest to warning if nc is a number,because 00000001 === 1
00000001 === 1