1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:57:44 +00:00

LibCrypto: Parse and store all RSA private key components

This commit is contained in:
Ali Mohammad Pur 2024-03-13 12:30:59 +01:00 committed by Andrew Kaster
parent dc1180d6b2
commit 15836cc865
5 changed files with 168 additions and 73 deletions

View file

@ -10,6 +10,14 @@
namespace Crypto::NumberTheory {
UnsignedBigInteger Mod(UnsignedBigInteger const& a, UnsignedBigInteger const& b)
{
UnsignedBigInteger result;
result.set_to(a);
result.set_to(result.divided_by(b).remainder);
return result;
}
UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b)
{
if (b == 1)

View file

@ -11,6 +11,7 @@
namespace Crypto::NumberTheory {
UnsignedBigInteger Mod(UnsignedBigInteger const& a, UnsignedBigInteger const& b);
UnsignedBigInteger ModularInverse(UnsignedBigInteger const& a_, UnsignedBigInteger const& b);
UnsignedBigInteger ModularPower(UnsignedBigInteger const& b, UnsignedBigInteger const& e, UnsignedBigInteger const& m);