Hello! This feature is implemented in C #. It already contains the text to be encrypted / decrypted. I do not know the language with # and therefore I ask for help. You can redo this function so that the following is displayed on startup:
- Enter the name of the source file: // enter the type name
d:\rfc795.txt
, it is encrypted, and after- Enter the name of the encrypted file: // enter the name of the file into which the encrypted information will be written, for example.
d:\q.txt
, then the file is decrypted.- Enter the name of the decrypted file: // here we write the name of the file, in which the decrypted information of the
d:\qq.txt
type will be written
You can also write a function that will display the time in milliseconds spent on encrypting and decrypting a file.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Crypto; namespace AESDemo { class Program { static void Main(string[] args) { // Примерно так. Как точно, должно быть описано там откуда скачан проект. // В имеющейся же реализации aes комментариев практически нет. Так что разобраться трудно. string message = "My Secret Message"; string key = "my_secret_key"; Console.WriteLine("Исходное сообщение: '{0}'", message); byte[] message_bytes = Encoding.Default.GetBytes(message); byte[] key_bytes = new byte[64]; Encoding.Default.GetBytes(key, 0, key.Length, key_bytes, 0); byte[] enc_message_bytes = null; uint msgnum = 1; AES.AES_CCM_Encrypt(message_bytes, key_bytes, out enc_message_bytes, 1, msgnum); Console.WriteLine("Зашифрованное сообщение: '{0}'", Encoding.Default.GetString(enc_message_bytes)); byte[] dec_message_bytes = null; AES.AES_CCM_Decrypt(enc_message_bytes, key_bytes, out dec_message_bytes, 1, out msgnum); Console.WriteLine("Расшифрованное сообщение: '{0}'", Encoding.Default.GetString(dec_message_bytes)); Console.ReadKey(); } } }