示例#1
0
        public void LucasSeqMod()
        {
            BigInteger index     = 1103;
            BigInteger module    = 4071461;
            BigInteger message   = 11111;
            var        seqPublic = new LucasSequences.LucasSequence(message, 1);

            var result = seqPublic[index, module];

            Assert.AreEqual <BigInteger>(result, 3975392);
        }
示例#2
0
        public void EncryptMessageMod()
        {
            AAtkin     a        = new AAtkin(1350);
            LucPrime   lucPrime = new LucPrime(a.RandomPrime, a.RandomPrime);
            BigInteger message  = 11111;

            LegendreNumbers legendreNumbers = new LucasSequences.LegendreNumbers(primeNumbers: lucPrime, message: message);
            LucPublicKey    publicKey       = new LucPublicKey(lucPrime);
            LucPrivateKey   privateKey      = new LucPrivateKey(publicKey, legendreNumbers);

            var seqPublic = new LucasSequences.LucasSequence(message, 1);

            var ciphertext = seqPublic[publicKey.e, publicKey.N];

            var seqPrivate = new LucasSequences.LucasSequence(ciphertext, 1);

            var result = seqPrivate[privateKey.d, privateKey.N];

            Assert.AreEqual <BigInteger>(result, message);
        }