.NET的DES加密算法在DELPHI里如何实现?

                            
public   static   string   EncryptDES(string   encryptString,   string   encryptKey,   Byte   []   IV)   
  {  
  try  
  {  
  byte[]   rgbKey   =   Encoding.UTF8.GetBytes(encryptKey.Substring(0,   8));  
  byte[]   rgbIV   =   (IV   ==   null)   ?   rgbKey   :   IV;  
  byte[]   inputByteArray   =   Encoding.UTF8.GetBytes(encryptString);  
  DESCryptoServiceProvider   dCSP   =   new   DESCryptoServiceProvider();  
  MemoryStream   mStream   =   new   MemoryStream();  
  CryptoStream   cStream   =   new   CryptoStream(mStream,   dCSP.CreateEncryptor(rgbKey,   rgbIV),   CryptoStreamMode.Write);  
  cStream.Write(inputByteArray,   0,   inputByteArray.Length);  
  cStream.FlushFinalBlock();  
  return   Convert.ToBase64String(mStream.ToArray());  
  }  
  catch  
  {  
  return   encryptString;  
  }  
  }

查看回复