diff --git a/include/opendht/crypto.h b/include/opendht/crypto.h
index 642eb461f1f118ca6e459d2acccf7f88a19bd7b9..f26a65f2af8271c356e46041181937db2233e2af 100644
--- a/include/opendht/crypto.h
+++ b/include/opendht/crypto.h
@@ -93,7 +93,7 @@ struct OPENDHT_PUBLIC PublicKey
     ~PublicKey();
     explicit operator bool() const { return pk; }
     bool operator ==(const PublicKey& o) const {
-        return pk == o.pk || getId() == o.getId();
+        return pk == o.pk || getLongId() == o.getLongId();
     }
     bool operator !=(const PublicKey& o) const {
         return !(*this == o);