Beispiel #1
0
        public static string affineDecrypt(int a, int b, string input)
        {
            //D(a,b,y)=a'*(y-b) (mod 26)
            int aOpposite = CryptographyUtils.oppositeModulo(a, CryptographyUtils.AlphabetLength);

            if (aOpposite == 0)
            {
                Console.WriteLine("Nie mogę znaleźć liczby przeciwnej w mod " + CryptographyUtils.AlphabetLength + " dla " + a + "!");
                return(null);
            }
            else
            {
                return(CryptographyUtils.decrypt(aOpposite, b, input));
            }
        }
Beispiel #2
0
 public static string caesarDecrypt(int key, string input)
 {
     //D(k,y)=y-k (mod 26)
     return(CryptographyUtils.decrypt(1, key, input));
 }