mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:37:35 +00:00
LibCrypto: Add the montgomery modular power algorithm
This algorithm allows for much faster computations of modular powers (around a 5x-10x speedup of the Crypto test). However, it is only valid for odd modulo values, and therefore the old algorithm must be kept for computations involving even modulo values.
This commit is contained in:
parent
5071989545
commit
485adb5e29
5 changed files with 264 additions and 2 deletions
|
@ -58,6 +58,7 @@ public:
|
|||
m_cached_trimmed_length = {};
|
||||
}
|
||||
|
||||
bool is_odd() const { return m_words.size() && (m_words[0] & 1); }
|
||||
bool is_invalid() const { return m_is_invalid; }
|
||||
|
||||
size_t length() const { return m_words.size(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue