• XSS.stack #1 – первый литературный журнал от юзеров форума

Encrypt a file in C# (AES & RSA algorithm)

Artem2245

CD-диск
Забанен
Регистрация
22.01.2022
Сообщения
14
Реакции
0
Пожалуйста, обратите внимание, что пользователь заблокирован
Hi guys

I want to encode part of a file but everything I do fails.

I want to encrypt part of a file, for example 7-10 MB of large files (files less than 10 MB to be fully encrypted)

Or like Phobos, encrypt three parts of each file. First, middle and last

And also do not have trouble decoding.

I will be grateful if you help me.
-----------------------------------------------------------------------------------------------------------------
 
Последнее редактирование:
Пожалуйста, обратите внимание, что пользователь заблокирован
1644272617000.png


C#:
  string path = @"C:\file";

            byte[] bytes = File.ReadAllBytes(path);

            int MB10 = 10485760;
            int MB7 = 7340032;

            if (bytes.Length > MB10)
            {
                Array array = bytes.ToArray();

                int number = 0;

                while (number < bytes.Length)
                {
                    if (((bytes.Length - number) > MB7))
                    {
                        Array array1 = new Array[MB7];

                        Array.Copy
                            (
                            array,
                            number,
                            array1,
                            0,
                            MB7
                            );

                        // array1 Encrypt

                        number = number + MB7;
                    }
                    else
                    {
                        Array array1 = new Array[bytes.Length - number];

                        Array.Copy
                            (
                            array,
                            number,
                            array1,
                            0,
                            bytes.Length - number
                            );

                        // array1 Encrypt

                        break;
                    }
                }

            }
            else
            {
                // Encrypt
            }
 
Пожалуйста, обратите внимание, что пользователь заблокирован
надеюсь никто не вздумает доебаться за то, что код слишком по-детски написан.

Я вижу , что человек задает простой вопрос и соответственно даю простое решение, которое новичек сможет прочитать "построчно".

---

I hope no one thinks to fuck for the fact that the code is written too childishly.

I see that a person asks a simple question and accordingly I give a simple solution that a beginner can read "line by line".
 
Пожалуйста, обратите внимание, что пользователь заблокирован
I want to encode part of a file but everything I do fails.


By the way, if you really decided to write your own R-ware, then unfortunately c# is the worst programming language for this task.

Default dotnet libraries related to cryptography are too slow.
 
Пожалуйста, обратите внимание, что пользователь заблокирован
By the way, if you really decided to write your own R-ware, then unfortunately c# is the worst programming language for this task.

Default dotnet libraries related to cryptography are too slow.
Thank you very much for your guidance
 
Пожалуйста, обратите внимание, что пользователь заблокирован


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх