Пример #1
0
        // final function
        public string Encrypt(string plainText, string key)
        {
            string localMessage;
            string localKey;
            char[,] localMatrix;
            string[] localDiagrams;
            string localCipher;
            Utilities utilityObject = new Utilities();
            char[] charsToNumbersObject = utilityObject.getCharsToNumbersMap();

            //filter message and key
            localMessage = utilityObject.messageFilter(plainText);
            localKey = utilityObject.messageFilter(key);

            // working on key >>

            // remove key duplication
            localKey = removeDuplicates(localKey);
            // matrix generation
            localMatrix = matrixFilling(localKey, charsToNumbersObject);

            // working on message >>

            // message handling
            localMessage = plainTextHandling(localMessage);
            // convert message to diagrams
            localDiagrams = toDiagrams(localMessage);
            // generating Cipher
            localCipher = diagramsMapping(localDiagrams, localMatrix);
            // to Capital Letters
            localCipher = utilityObject.toCapitalLetters(localCipher);

            return localCipher;
        }
 public Monoalphabetic()
 {
     utilityObject = new Utilities();
 }