Пример #1
0
        public string EncryptMessage(string plainText, string memorableKey)
        {
            var cipherKey        = _keyManagement.GenerateCipherKey(memorableKey);
            var sanitizedMessage = PlayfairUtil.GetSanitisedString(plainText);
            var digraphs         = _digrathGenerator.GetMessageDigraths(sanitizedMessage);

            return(Encrypt(digraphs, cipherKey));
        }
Пример #2
0
        public string EncryptMessage(string plainText, PlayfairKey cipherKey)
        {
            if (!_keyManagement.IsValidCipherKey(cipherKey))
            {
                throw new ArgumentException("Invalid cipher key.");
            }

            var sanitizedMessage = PlayfairUtil.GetSanitisedString(plainText);
            var digraths         = _digrathGenerator.GetMessageDigraths(sanitizedMessage);

            return(Encrypt(digraths, cipherKey));
        }