티스토리 뷰
EncryptString(암호키, 암호화할 문자열);
private static string EncryptString(string InputText, string KeyString)
{
RijndaelManaged RijndaelCipher = new RijndaelManaged();
byte[] PlainText = Encoding.Unicode.GetBytes(InputText);
byte[] Salt = Encoding.ASCII.GetBytes(KeyString.Length.ToString());
PasswordDeriveBytes SecureKey = new PasswordDeriveBytes(KeyString, Salt);
ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecureKey.GetBytes(32), SecureKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream();
CryptoStream cryptoStream = new CryptoStream(memoryStream, Encryptor, CryptoStreamMode.Write);
cryptoStream.Write(PlainText, 0, PlainText.Length);
cryptoStream.FlushFinalBlock();
byte[] CipherBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string EncryptedData = Convert.ToBase64String(CipherBytes);
return EncryptedData;
}
DecryptString(암호키, 복호화할문자열);
private static string DecryptString(string InputText, string KeyString)
{
RijndaelManaged RijndaelCipher = new RijndaelManaged();
byte[] EncryptedData = Convert.FromBase64String(InputText);
byte[] Salt = Encoding.ASCII.GetBytes(KeyString.Length.ToString());
PasswordDeriveBytes SecureKey = new PasswordDeriveBytes(KeyString, Salt);
ICryptoTransform Decryptor = RijndaelCipher.CreateDecryptor(SecureKey.GetBytes(32), SecureKey.GetBytes(16));
MemoryStream memoryStream = new MemoryStream(EncryptedData);
CryptoStream cryptoStream = new CryptoStream(memoryStream, Decryptor, CryptoStreamMode.Read);
byte[] PlainText = new byte[EncryptedData.Length];
int DecryptedCount = cryptoStream.Read(PlainText, 0, PlainText.Length);
memoryStream.Close();
cryptoStream.Close();
string DecryptedData = Encoding.Unicode.GetString(PlainText, 0, DecryptedCount);
return DecryptedData;
}
- Total
- Today
- Yesterday
- c# SpeechSynthesizer
- 스털링엔진
- c# 음성
- 암호화
- 복호화
- 이 행은
- NET FRAMEWORK
- Xingapi
- imemode
- ESP32
- c# Speech
- c#
- framework
- MySQL
- 베란다 텃밭
- C# textbox 커서 위치
- 코딩
- 시스템트레이딩
- 베란타
- ArgumentException
- 베란다 방울토마토
- 방울토마토
- 스털링
- C# 마우스 폼이동
- 드론
- 인삼키우기
- C# textbox 커서 시작
- 이베스트
- C# textbox 커서 마지막
- 앉은뱅이 방울토마토
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |