Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function H(text: Buffer, alg: string): Buffer {
return Hashes.createHash(alg)
.update(text)
.digest();
}
.digest();
const ha1 = Hashes.createHash('md5')
.update(base)
.update(':')
.update(this.nonce!)
.update(':')
.update(cnonce);
if (credentials.authzid) {
ha1.update(':').update(credentials.authzid);
}
const dha1 = ha1.digest('hex');
const ha2 = Hashes.createHash('md5')
.update('AUTHENTICATE:')
.update(uri);
const dha2 = ha2.digest('hex');
const digest = Hashes.createHash('md5')
.update(dha1)
.update(':')
.update(this.nonce!)
.update(':')
.update(nc)
.update(':')
.update(cnonce)
.update(':')
.update(qop)
.update(':')
.update(dha2)
.digest('hex');
str += ',response=' + digest;
if (this.charset === 'utf-8') {
str += ',charset=utf-8';
}
constructor(opts = {}) {
super();
this.config = {
chunkSize: 16384,
hash: 'sha-1',
...opts
};
this.file = undefined;
this.channel = undefined;
this.hash = Hashes.createHash(this.config.hash);
}
if (!identities || !features || !extensions) {
return null;
}
for (const id of identities) {
append(id);
}
for (const feature of features) {
append(feature);
}
for (const form of extensions) {
append(form);
}
return Hashes.createHash(hashName)
.update(Buffer.concat(S))
.digest('base64');
}