Пример #1
0
        // CONSTRUCTORS
        public AffineCipher(Classes.Alphabet alphabet, int a, int b)
        {
            this.a = a;
            this.b = b;
            this.m = alphabet.Lenght;

            int gcd = Math.Algorithms.GCD(a, m);

            if (gcd != 1)
            {
                throw new System.ArgumentException(string.Format("Numbers \"A\" and \"M\" must be relatively simple\n A: {0} M: {1} GCD: {2}"
                                                                 , a, m, gcd));
            }

            this.letterCipherTable = new System.Collections.Generic.SortedDictionary <char, char>();
            this.alphabet          = alphabet;
            this.CreateLetterCipherTable();
        }
Пример #2
0
 // CONSTRUCTORS
 public HillCipher(Classes.Alphabet alphabet, string keyWord)
 {
     this.alphabet = alphabet;
     this.letters  = Alphabet.Letters.ToList();
     this.KeyWord  = keyWord;
 }
Пример #3
0
 // CONSTRUCTORS
 public BBSCipher(Classes.Alphabet alphabet, RandomGenerator.BBS bbs)
 {
     this.alphabet = alphabet;
     this.bbs      = bbs;
 }
 // CONSTRUCTORS
 public GronsfeldCipher(Classes.Alphabet alphabet, uint[] key)
 {
     this.alphabet = alphabet;
     this.key      = key;
 }