Ejemplo n.º 1
0
        public string Encode(string plaintext)
        {
            _dictionary = _dictionaryService.CreateDictionary(plaintext);

            var encryptedMessageBuilder = new StringBuilder();

            foreach (var letter in plaintext)
            {
                encryptedMessageBuilder.Append(_dictionary[letter]);
                encryptedMessageBuilder.Append(" ");
            }

            encryptedMessageBuilder.Remove(encryptedMessageBuilder.Length - 1, 1);
            var processedCipher = ProcessCipherText(encryptedMessageBuilder.ToString());

            return(processedCipher);
        }
 public async Task <IActionResult> Create([FromBody] DictionaryModel data)
 {
     return(Json(data: await _service.CreateDictionary(GetUserId(), data)));
 }