示例#1
0
文件: Program.cs 项目: eProw/Console
 public CryptoRSA()
 {
     _core      = new CryptoCore();
     _p         = _core.GetRandomPrime(1, MaxPrimeP);
     _q         = _core.GetRandomPrime(1, MaxPrimeQ);
     _modulus   = _core.KaratsubaMultiply(_p, _q);
     _totient   = _modulus - (_p + _q - 1);
     _key       = _core.GetRandomPrime(1, _totient);
     _d         = _core.ModularMultiplicativeInverse(_key, _totient);
     CryptoData = new CryptoRSAData(_modulus, _key);
 }
示例#2
0
文件: Program.cs 项目: eProw/Console
 public long Encryption(long message, CryptoRSAData cryptoData)
 {
     return(_core.Pows(message, cryptoData.Key, cryptoData.Modulus));
 }