Skip to content

Commit 6899097

Browse files
committed
Optimize point hash to avoid loss of 1 bit of sha256 entropy.
1 parent 77c20c2 commit 6899097

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

include/bitcoin/system/chain/point.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ struct hash<bc::system::chain::point>
134134
{
135135
size_t operator()(const bc::system::chain::point& value) const NOEXCEPT
136136
{
137-
return bc::system::hash_combine(value.index(),
138-
bc::system::unique_hash(value.hash()));
137+
// Right should always be the lower entropy value (i.e. point index).
138+
return bc::system::hash_combine(bc::system::unique_hash(value.hash()),
139+
value.index());
139140
}
140141
};
141142

0 commit comments

Comments
 (0)