Answer the question
In order to leave comments, you need to log in
How to encrypt and decrypt strings (with sending and receiving a string)?
My data is stored in files that can be easily accessed, so they need to be encrypted so that there is a set of characters .....
In fact, I need two methods
private string StrEncode(string str){
string CodeStr = "";
......................................
return CodeStr ;
}
private string StrDecode(string Str){
string NormalizeStr = "";
......................................
return NormalizeStr;
}
Answer the question
In order to leave comments, you need to log in
You can use the library or look at the implementation:
https://github.com/2Toad/Rijndael256
https://www.nuget.org/packages/Rijndael256.Core/3.2.5
Read chapter 3 in the book: Advanced ASP.NET Core 3 Security . Understanding Hacks, Attacks, and Vulnerabilities to Secure Your Website . You will learn about the problems of text encryption, for example, and in general you will see the source codes of examples, as you need. The book can be purchased from Amazon for a Windows app called Kindle.
string password = "sKzvYk#1Pn33!YN"; // The password to encrypt the data with
string plaintext = "Top secret data"; // The string to encrypt
// Encrypt the string
string ciphertext = Rijndael.Encrypt(plaintext, password, KeySize.Aes256);
// Decrypt the string
plaintext = Rijndael.Decrypt(ciphertext, password, KeySize.Aes256);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question