using System.Security.Cryptography;
public static void Main()
Console.WriteLine("Hello World~~");
Console.WriteLine(GetKCVDES());
public static string GetKCVDES()
byte[] key = new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF };
byte[] iv = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
byte[] data = new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
DES des = new DESCryptoServiceProvider();
using (MemoryStream memoryStream = new MemoryStream())
using (CryptoStream cryptoStream = new CryptoStream(memoryStream, des.CreateEncryptor(key, iv), CryptoStreamMode.Write))
cryptoStream.Write(data, 0, data.Length);
cryptoStream.FlushFinalBlock();
return ByteArrayToString(memoryStream.ToArray()).Remove(6);
public static string ByteArrayToString(byte[] ba)
StringBuilder hex = new StringBuilder(ba.Length * 2);
hex.AppendFormat("{0:x2}", b);
return hex.ToString().ToUpper();