การเข้ารหัส (Encrypt)
การถอดรหัส (Decrypt)
ส่วนนี่ที่อยู่เว็บครับ [You must be registered and logged in to see this link.]
ตี 3 ละไปนอนละครับ
- Code:
public string Encrypt(string strInput)
{
Encoding ec = Encoding.Default;
byte[] array = ec.GetBytes(strInput);
List<byte> listxor = new List<byte>();
foreach (byte b in array)
{
byte xor = (byte)(b ^ 0x5E);
listxor.Add(xor);
}
string HEX = GetHEXstring(listxor.ToArray()).ToString();
return HEX;
}
การถอดรหัส (Decrypt)
- Code:
<strong> public static string Decrypt(string strInput)
{
byte[] array = new byte[strInput.Length / 2];
List<byte> listxor = new List<byte>();
for (int i = 0; i < strInput.Length - 1; i = i + 2)
{
string strhex = strInput.Substring(i, 2);
if (strhex != null)
{
int hexnum = int.Parse(strhex, System.Globalization.NumberStyles.HexNumber);
byte b = (byte)(hexnum ^ 0x5e);
listxor.Add(b);
}
}
return Encoding.Default.GetString(listxor.ToArray());
}</strong>
ส่วนนี่ที่อยู่เว็บครับ [You must be registered and logged in to see this link.]
ตี 3 ละไปนอนละครับ