C#代码:
public static string Enc(string data)
{
System.Text.Encoding unicode = System.Text.Encoding.Unicode;
byte[] rgbKey = new byte[] {1,2,3,4,5,6,7,8};
byte[] rgbIV = new byte[] {1,2,3,4,5,6,7,8};
System.Security.Cryptography.DESCryptoServiceProvider dESCryptoServiceProvider = new System.Security.Cryptography.DESCryptoServiceProvider();
System.Security.Cryptography.ICryptoTransform cryptoTransform = dESCryptoServiceProvider.CreateEncryptor(rgbKey, rgbIV);
byte[] bytes = unicode.GetBytes(data);
byte[] array = cryptoTransform.TransformFinalBlock(bytes, 0, bytes.Length);
result = System.Convert.ToBase64String(array, 0, array.Length);
}