aboutsummaryrefslogtreecommitdiff
path: root/src/crypto
diff options
context:
space:
mode:
authorFabian Jahr <fjahr@protonmail.com>2021-02-25 19:09:12 +0100
committerFabian Jahr <fjahr@protonmail.com>2021-04-19 20:28:46 +0200
commit2e2648a9021dfbb6e17dfa81472f057dacbc34e0 (patch)
treed1596c1afc1bf66d07402277c2ff6b2dbcebb6e7 /src/crypto
parent13d27b452d4b60010c54d4f80757dea9805076be (diff)
downloadbitcoin-2e2648a9021dfbb6e17dfa81472f057dacbc34e0.tar.xz
crypto: Make MuHash Remove method efficient
Division of MuHash objects are very expensive and multiplication relatively cheap. The whole idea of introducing and tracking numerator and denominators seperately as a representation of the internal state was so that divisions would be rare. So using divison in the Remove method did not make any sense and was just a silly mistake which is corrected here.
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/muhash.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/muhash.cpp b/src/crypto/muhash.cpp
index e5a0d4cb9c..a2b769cd56 100644
--- a/src/crypto/muhash.cpp
+++ b/src/crypto/muhash.cpp
@@ -341,6 +341,6 @@ MuHash3072& MuHash3072::Insert(Span<const unsigned char> in) noexcept {
}
MuHash3072& MuHash3072::Remove(Span<const unsigned char> in) noexcept {
- m_numerator.Divide(ToNum3072(in));
+ m_denominator.Multiply(ToNum3072(in));
return *this;
}