Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this.qop === "auth") {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = MD5(this.method + ":" + this.uri);
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth:" + ha2);
} else if (this.qop === "auth-int") {
// HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
ha2 = MD5(this.method + ":" + this.uri + ":" + MD5(body ? body : ""));
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth-int:" + ha2);
} else if (this.qop === undefined) {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = MD5(this.method + ":" + this.uri);
// response = MD5(HA1:nonce:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + ha2);
}
}
}
let ha2;
// HA1 = MD5(A1) = MD5(username:realm:password)
const ha1 = MD5(this.username + ":" + this.realm + ":" + this.password);
if (this.qop === "auth") {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = MD5(this.method + ":" + this.uri);
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth:" + ha2);
} else if (this.qop === "auth-int") {
// HA2 = MD5(A2) = MD5(method:digestURI:MD5(entityBody))
ha2 = MD5(this.method + ":" + this.uri + ":" + MD5(body ? body : ""));
// response = MD5(HA1:nonce:nonceCount:credentialsNonce:qop:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + this.ncHex + ":" + this.cnonce + ":auth-int:" + ha2);
} else if (this.qop === undefined) {
// HA2 = MD5(A2) = MD5(method:digestURI)
ha2 = MD5(this.method + ":" + this.uri);
// response = MD5(HA1:nonce:HA2)
this.response = MD5(ha1 + ":" + this.nonce + ":" + ha2);
}
}
}
it('returns the correct Gravatar URL', () => {
const email = 'example@example.com';
const rendered = TestRenderer.create(
);
const src = rendered.toTree().instance.gravatarSrc();
const base = 'https://www.gravatar.com/avatar/';
const hash = MD5(email);
const dimensions = 56;
expect(src).toEqual(`${base}${hash}?s=${dimensions}&d=blank`);
});
});
plaintextChange = (event) => {
let state = {...this.state}
state.plaintext = event.target.value
state.ciphertext = MD5(state.plaintext).toString()
state.ciphertextCapital = state.ciphertext.toUpperCase()
state.ciphertext16 = state.ciphertext.substr(8, 16)
state.ciphertextCapital16 = state.ciphertextCapital.substr(8, 16)
this.setState(state)
}
gravatarUrl(mailbox) {
let email = mailbox.address
let hash = md5(email)
return 'https://www.gravatar.com/avatar/' + hash + '?d=identicon'
}
},
'charts.update.data'(chartId, data) {
return Charts.update(chartId, {
$set: {
data: data,
md5: MD5(data).toString(),
lastEdited: new Date()
}
});
},
'charts.update.dateformat'(chartId, format) {
protected getHash() {
return MD5(JSON.stringify(this.data)).toString();
}
gravatarSrc() {
const { theme, gravatarEmail, size } = this.props;
const { dimensions } = getSizeParams(theme, size);
const base = 'https://www.gravatar.com/avatar/';
const hash = MD5(gravatarEmail.toLowerCase());
return `${base}${hash}?s=${dimensions}&d=blank`;
}
fingerPrint(situation) {
return btoa(md5(situation.relatedAlarms));
}
String.prototype.md5 = function () {
return MD5(this)
}
let session = utils.loadLoginSession()