Exemplo n.º 1
0
        private BigInteger GetValueY(BigInteger x)
        {
            BigInteger value = GetYSquare(x);
            BigInteger y     = BigIntigerMath.SqrtModEuler(value, modulo);

            return(y);
        }
Exemplo n.º 2
0
        public Point EncryptMessage(string massage, BigInteger ni)
        {
            byte[] bytes = System.Text.Encoding.UTF8.GetBytes(massage);

            BigInteger M = new BigInteger(bytes);

            for (int i = 1; i <= ni; i++)
            {
                BigInteger x       = (M * ni + i) % modulo;
                BigInteger ySquare = (BigInteger.ModPow(x, 3, modulo) + x * A + B) % modulo;

                if (SquareRest.IsSquareRest(modulo, ySquare))
                {
                    BigInteger y = BigIntigerMath.SqrtModEuler(ySquare, modulo);

                    return(new Point(x, y));
                }
            }
            return(new Point(-1));
        }