mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-03-13 11:00:10 +08:00
nit: simplify equality check
This commit is contained in:
parent
963cc997b2
commit
543dbe6c29
@ -109,14 +109,7 @@ func (sk *RsaPrivateKey) Equals(k Key) bool {
|
||||
b := other.sk
|
||||
|
||||
// Don't care about constant time. We're only comparing the public half.
|
||||
if a.PublicKey.N.Cmp(b.PublicKey.N) != 0 {
|
||||
return false
|
||||
}
|
||||
if a.PublicKey.E != b.PublicKey.E {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
return a.PublicKey.N.Cmp(b.PublicKey.N) == 0 && a.PublicKey.E == b.PublicKey.E
|
||||
}
|
||||
|
||||
// UnmarshalRsaPrivateKey returns a private key from the input x509 bytes
|
||||
|
Loading…
Reference in New Issue
Block a user