34 lines
1.2 KiB
C#
34 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Security.Cryptography;
|
|
namespace PatientMan
|
|
{
|
|
|
|
public static class strUtil
|
|
{
|
|
|
|
private static byte[] key = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
|
private static byte[] iv = new byte[8] { 1, 2, 3, 4, 5, 6, 7, 8 };
|
|
|
|
public static string Crypt(this string text)
|
|
{
|
|
//SymmetricAlgorithm algorithm = DES.Create();
|
|
//ICryptoTransform transform = algorithm.CreateEncryptor(key, iv);
|
|
//byte[] inputbuffer = Encoding.Unicode.GetBytes(text);
|
|
//byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
|
|
return text; // Convert.ToBase64String(outputBuffer);
|
|
}
|
|
|
|
public static string Decrypt(this string text)
|
|
{
|
|
//SymmetricAlgorithm algorithm = DES.Create();
|
|
//ICryptoTransform transform = algorithm.CreateDecryptor(key, iv);
|
|
//byte[] inputbuffer = Convert.FromBase64String(text);
|
|
//byte[] outputBuffer = transform.TransformFinalBlock(inputbuffer, 0, inputbuffer.Length);
|
|
return text; // Encoding.Unicode.GetString(outputBuffer);
|
|
}
|
|
}
|
|
}
|