示例#1
0
        public StringBuilder DecodingUA(StringBuilder inputText, GrilleKey key)
        {
            StringBuilder res = new StringBuilder();

            List <StringBuilder> blockStringBuilders = TextPreparationDecoding(inputText);

            foreach (StringBuilder blockStringBuilder in blockStringBuilders)
            {
                res.Append(FullStringReverse(blockStringBuilder, InitialTemplateMatrix(key)));
            }

            return(res);
        }
示例#2
0
        private List <int> InitialTemplateMatrix(GrilleKey key)
        {
            List <List <int> > res = MatrixHelpCardoneAlgoritm.ZeroMatrix;

            List <List <int> > rotateMatrix = key.Key;

            for (int i = 0; i < res.Count; i++)
            {
                List <List <int> > temp =
                    MatrixService.VectorInMatrix(rotateMatrix, MatrixHelpCardoneAlgoritm.InputTextMatrix[i]);

                res = MatrixService.Addition(temp, res);
                if (i % 2 == 0)
                {
                    rotateMatrix = MatrixService.Multiply(rotateMatrix, MatrixHelpCardoneAlgoritm.InvertingMatrix);
                }
                else
                {
                    rotateMatrix = MatrixService.Multiply(MatrixHelpCardoneAlgoritm.InvertingMatrix, rotateMatrix);
                }
            }

            return(MatrixService.ToVector(res));
        }