Skip to content

Commit 2e2648a

Browse files
committed
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.
1 parent 13d27b4 commit 2e2648a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/crypto/muhash.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,6 @@ MuHash3072& MuHash3072::Insert(Span<const unsigned char> in) noexcept {
341341
}
342342

343343
MuHash3072& MuHash3072::Remove(Span<const unsigned char> in) noexcept {
344-
m_numerator.Divide(ToNum3072(in));
344+
m_denominator.Multiply(ToNum3072(in));
345345
return *this;
346346
}

0 commit comments

Comments
 (0)