diff --git a/common/bitmap_store.cpp b/common/bitmap_store.cpp
index 3bca791cac..1671deca7e 100644
--- a/common/bitmap_store.cpp
+++ b/common/bitmap_store.cpp
@@ -28,7 +28,7 @@
 #include <bitmaps.h>
 #include <bitmap_store.h>
 #include <bitmaps/bitmap_info.h>
-#include <hash_eda.h>
+#include <hash.h>
 #include <kiplatform/ui.h>
 #include <paths.h>
 #include <pgm_base.h>
diff --git a/common/hash_eda.cpp b/common/hash_eda.cpp
index 0939d2bc68..196731a3f1 100644
--- a/common/hash_eda.cpp
+++ b/common/hash_eda.cpp
@@ -24,7 +24,7 @@
  */
 
 #include <hash_eda.h>
-
+#include <hash.h>
 #include <footprint.h>
 #include <fp_text.h>
 #include <fp_textbox.h>
@@ -77,14 +77,11 @@ size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags )
     {
         const PAD* pad = static_cast<const PAD*>( aItem );
 
-        ret = hash<int>{}( static_cast<int>( pad->GetShape() ) << 16 );
-        hash_combine( ret, pad->GetDrillShape() << 18 );
-        hash_combine( ret, pad->GetSize().x << 8 );
-        hash_combine( ret, pad->GetSize().y << 9 );
-        hash_combine( ret, pad->GetOffset().x << 6 );
-        hash_combine( ret, pad->GetOffset().y << 7 );
-        hash_combine( ret, pad->GetDelta().x << 4 );
-        hash_combine( ret, pad->GetDelta().y << 5 );
+        ret = hash<int>{}( static_cast<int>( pad->GetShape() ) );
+        hash_combine( ret, pad->GetDrillShape() );
+        hash_combine( ret, pad->GetSize().x, pad->GetSize().y );
+        hash_combine( ret, pad->GetOffset().x, pad->GetOffset().y );
+        hash_combine( ret, pad->GetDelta().x, pad->GetDelta().y );
 
         hash_combine( ret, hash_board_item( pad, aFlags ) );
 
diff --git a/include/hash_eda.h b/include/hash_eda.h
index c9e2ae41c5..ca90f5eee3 100644
--- a/include/hash_eda.h
+++ b/include/hash_eda.h
@@ -60,32 +60,4 @@ enum HASH_FLAGS
  */
 std::size_t hash_fp_item( const EDA_ITEM* aItem, int aFlags = HASH_FLAGS::HASH_ALL );
 
-/**
- * This is a dummy function to take the final case of hash_combine below
- * @param seed
- */
-static inline void hash_combine( std::size_t &seed ) {}
-
-/**
- * Combine multiple hashes utilizing previous hash result.
- *
- * @tparam T      A hashable type
- * @param seed    A seed value input and output for the result.
- * @param val     A hashable object of type T
- */
-template< typename T, typename ... Types >
-static inline void hash_combine( std::size_t &seed, const T &val, const Types &... args )
-{
-    seed ^= std::hash<T>()( val ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
-    hash_combine( seed, args... );
-}
-
-template <typename... Types>
-static inline std::size_t hash_val( const Types &... args )
-{
-    std::size_t seed = 0xa82de1c0;
-    hash_combine( seed, args... );
-    return seed;
-}
-
 #endif
diff --git a/libs/kimath/include/hash.h b/libs/kimath/include/hash.h
new file mode 100644
index 0000000000..b62957d42e
--- /dev/null
+++ b/libs/kimath/include/hash.h
@@ -0,0 +1,58 @@
+/*
+ * This program source code file is part of KiCad, a free EDA CAD application.
+ *
+ * Copyright (C) 2022 KiCad Developers, see CHANGELOG.TXT for contributors.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, you may find one here:
+ * http://www.gnu.org/licenses/gpl-3.0.html
+ * or you may search the http://www.gnu.org website for the version 3 license,
+ * or you may write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#pragma once
+#ifndef LIBS_KIMATH_INCLUDE_HASH_H_
+#define LIBS_KIMATH_INCLUDE_HASH_H_
+
+#include <functional>
+
+/**
+ * This is a dummy function to take the final case of hash_combine below
+ * @param seed
+ */
+static inline void hash_combine( std::size_t &seed ) {}
+
+/**
+ * Combine multiple hashes utilizing previous hash result.
+ *
+ * @tparam T      A hashable type
+ * @param seed    A seed value input and output for the result.
+ * @param val     A hashable object of type T
+ */
+template< typename T, typename ... Types >
+static inline void hash_combine( std::size_t &seed, const T &val, const Types &... args )
+{
+    seed ^= std::hash<T>()( val ) + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 );
+    hash_combine( seed, args... );
+}
+
+template <typename... Types>
+static inline std::size_t hash_val( const Types &... args )
+{
+    std::size_t seed = 0xa82de1c0;
+    hash_combine( seed, args... );
+    return seed;
+}
+
+#endif /* LIBS_KIMATH_INCLUDE_HASH_H_ */
diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp
index 7a290c278f..c227cfc431 100644
--- a/libs/kimath/src/geometry/shape_poly_set.cpp
+++ b/libs/kimath/src/geometry/shape_poly_set.cpp
@@ -53,6 +53,7 @@
 #include <math/util.h>                       // for KiROUND, rescale
 #include <math/vector2d.h>                   // for VECTOR2I, VECTOR2D, VECTOR2
 #include <md5_hash.h>
+#include <hash.h>
 #include <geometry/shape_segment.h>
 #include <geometry/shape_circle.h>
 
@@ -1122,8 +1123,9 @@ void SHAPE_POLY_SET::unfractureSingle( SHAPE_POLY_SET::POLYGON& aPoly )
             std::size_t operator()(  const EDGE& aEdge ) const
             {
                 const SEG& a = aEdge.m_poly->CSegment( aEdge.m_index );
-
-                return (std::size_t) ( a.A.x + a.B.x + a.A.y + a.B.y );
+                std::size_t seed = 0xa82de1c0;
+                hash_combine( seed, a.A.x, a.B.x, a.A.y, a.B.y );
+                return seed;
             }
         };
     };
diff --git a/pcbnew/board.h b/pcbnew/board.h
index c53b1061e1..c4cb4e954b 100644
--- a/pcbnew/board.h
+++ b/pcbnew/board.h
@@ -28,6 +28,7 @@
 #include <board_item_container.h>
 #include <common.h> // Needed for stl hash extensions
 #include <convert_shape_list_to_polygon.h> // for OUTLINE_ERROR_HANDLER
+#include <hash.h>
 #include <layer_ids.h>
 #include <netinfo.h>
 #include <pcb_item_containers.h>
@@ -105,10 +106,9 @@ namespace std
     {
         std::size_t operator()( const PTR_PTR_CACHE_KEY& k ) const
         {
-            constexpr std::size_t prime = 2166136261u;
-
-            return reinterpret_cast<uintptr_t>( k.A ) * prime
-                    ^ reinterpret_cast<uintptr_t>( k.B ) * prime;
+            std::size_t seed = 0xa82de1c0;
+            hash_combine( seed, k.A, k.B );
+            return seed;
         }
     };
 
@@ -117,10 +117,9 @@ namespace std
     {
         std::size_t operator()( const PTR_LAYER_CACHE_KEY& k ) const
         {
-            constexpr std::size_t prime = 2166136261u;
-
-            return reinterpret_cast<uintptr_t>( k.A ) * prime
-                    ^ hash<int>()( k.Layer ) * prime;
+            std::size_t seed = 0xa82de1c0;
+            hash_combine( seed, k.A, k.Layer );
+            return seed;
         }
     };
 
@@ -129,11 +128,9 @@ namespace std
     {
         std::size_t operator()( const PTR_PTR_LAYER_CACHE_KEY& k ) const
         {
-            constexpr std::size_t prime = 2166136261u;
-
-            return reinterpret_cast<uintptr_t>( k.A ) * prime
-                    ^ reinterpret_cast<uintptr_t>( k.B ) * prime
-                    ^ hash<int>()( k.Layer ) * prime;
+            std::size_t seed = 0xa82de1c0;
+            hash_combine( seed, k.A, k.B, k.Layer );
+            return seed;
         }
     };
 }
diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h
index 788c3adaaf..83ba995d99 100644
--- a/pcbnew/pcb_edit_frame.h
+++ b/pcbnew/pcb_edit_frame.h
@@ -21,8 +21,6 @@
 #ifndef  __PCB_EDIT_FRAME_H__
 #define  __PCB_EDIT_FRAME_H__
 
-#include <unordered_map>
-#include <map>
 #include "pcb_base_edit_frame.h"
 #include "zones.h"
 #include <mail_type.h>
diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.h b/pcbnew/plugins/fabmaster/import_fabmaster.h
index 0e1a791b42..ad90b68b84 100644
--- a/pcbnew/plugins/fabmaster/import_fabmaster.h
+++ b/pcbnew/plugins/fabmaster/import_fabmaster.h
@@ -28,7 +28,6 @@
 
 #include <eda_text.h>
 #include <geometry/shape_arc.h>
-#include <hash_eda.h>
 #include <pad_shapes.h>
 
 #include <deque>