public static BigInt EncryptRSA(Key PrivateK, BigInt PPlain) { PublicKey PK = PrivateK as PublicKey; BigInt PCipher = PPlain.PowModPrim(PK.E, PK.N); return(PCipher); }
public static BigInt DecryptRSA(Key PrivateK, BigInt PCipher) { PrivateKey PK = PrivateK as PrivateKey; BigInt PPlain = PCipher.PowModPrim(PK.D, PK.N); return(PPlain); }
public BigInt GetNextSeed(int i = 0) { BigInt B2 = new BigInt(this.S.Size, 2); if (i <= 0) { BigInt Seed = this.S.PowModPrim(B2, this.N); return(Seed); } else { BigInt Index = new BigInt(this.S.Size, i); BigInt ScmPQ = BigInt.Scm(P - 1, Q - 1); BigInt Exp = B2.PowModPrim(Index, ScmPQ); BigInt Seed = this.S.PowModPrim(Exp, this.N); return(Seed); } }