diff --git a/include/opendht/infohash.h b/include/opendht/infohash.h
index 414c528b8a7cd79a402875d6a822b2ac7625b0fd..d4f2c7e43ff48015a9070fe5ad0cff30a8c9635e 100644
--- a/include/opendht/infohash.h
+++ b/include/opendht/infohash.h
@@ -103,11 +103,8 @@ public:
     static constexpr inline Hash zero() noexcept { return Hash{}; }
 
     bool operator==(const Hash& h) const {
-        auto a = reinterpret_cast<const uint32_t*>(data_.data());
-        auto b = reinterpret_cast<const uint32_t*>(h.data_.data());
-        constexpr unsigned n = N / sizeof(uint32_t);
-        for (unsigned i=0; i < n; i++)
-            if (a[i] != b[i])
+        for (unsigned i=0; i < N; i++)
+            if (data_[i] != h.data_[i])
                 return false;
         return true;
     }