Don't hash when comparing key fingerprints

This commit is contained in:
Daniel Huigens
2018-10-31 20:39:33 +01:00
parent abce79b509
commit 7253df1632
2 changed files with 22 additions and 6 deletions

View File

@@ -229,10 +229,18 @@ PublicKey.prototype.getFingerprintBytes = function () {
* Calculates the fingerprint of the key
* @returns {String} A string containing the fingerprint in lowercase hex
*/
PublicKey.prototype.getFingerprint = function () {
PublicKey.prototype.getFingerprint = function() {
return util.Uint8Array_to_hex(this.getFingerprintBytes());
};
/**
* Calculates whether two keys have the same fingerprint without actually calculating the fingerprint
* @returns {Boolean} Whether the two keys have the same version and public key data
*/
PublicKey.prototype.hasSameFingerprintAs = function(other) {
return this.version === other.version && util.equalsUint8Array(this.writePublicKey(), other.writePublicKey());
};
/**
* Returns algorithm information
* @returns {Object} An object of the form {algorithm: String, bits:int, curve:String}