|
| template<typename IntType > |
| IntType | CalculateGCD (IntType ValueA, IntType ValueB) |
| |
| template<typename IntType > |
| IntType | CalculateMultiplicativeInverseOfExponent (IntType Exponent, IntType Totient) |
| |
| template<typename IntType > |
| void | GenerateKeyPair (const IntType &P, const IntType &Q, FEncryptionKey &PublicKey, FEncryptionKey &PrivateKey) |
| |
| template<typename IntType > |
| IntType | ModularPow (IntType Base, IntType Exponent, IntType Modulus) |
| |
| template<typename IntType > |
| void | EncryptBytes (IntType *EncryptedData, const uint8 *Data, const int64 DataLength, const FEncryptionKey &EncryptionKey) |
| |
| template<typename IntType > |
| void | DecryptBytes (uint8 *DecryptedData, const IntType *Data, const int64 DataLength, const FEncryptionKey &DecryptionKey) |
| |
| void | EncryptSignature (const FDecryptedSignature &InUnencryptedSignature, FEncryptedSignature &OutEncryptedSignature, const FEncryptionKey &EncryptionKey) |
| |
| void | DecryptSignature (const FEncryptedSignature &InEncryptedSignature, FDecryptedSignature &OutUnencryptedSignature, const FEncryptionKey &EncryptionKey) |
| |
Math utils for encryption.
| IntType FEncryption::CalculateMultiplicativeInverseOfExponent |
( |
IntType |
Exponent, |
|
|
IntType |
Totient |
|
) |
| |
Multiplicative inverse of exponent using extended GCD algorithm.
Extended gcd: ax + by = gcd(a, b), where a = exponent, b = fi(n), gcd(a, b) = gcd(e, fi(n)) = 1, fi(n) is the Euler's totient function of n We only care to find d = x, which is our multiplicatve inverse of e (a).