예제 #1
0
파일: TripleDES.cs 프로젝트: Jeff-Bee/qdh
 /// <summary>
 /// Decrypts hexadecimal data using a DES key.
 /// </summary>
 /// <param name="key">DES key to use with the decrypt operation.</param>
 /// <param name="data">Hexadecimal data to decrypt.</param>
 /// <returns>Decrypted hexadecimal data.</returns>
 public static string Decrypt(DESKey key, string data)
 {
     return(DESDecrypt(key.FirstKeyPart.ToString().HexToByteArray(),
                       DESEncrypt(key.SecondKeyPart.ToString().HexToByteArray(),
                                  DESDecrypt(key.ThirdKeyPart.ToString().HexToByteArray(), data.HexToByteArray()))
                       ).ByteArrayToHex());
 }
예제 #2
0
파일: TripleDES.cs 프로젝트: Jeff-Bee/qdh
 /// <summary>
 /// Decrypts hexadecimal data using a single-length DES key.
 /// </summary>
 /// <param name="key">DES key to use with the decrypt operation.</param>
 /// <param name="data">Hexadecimal data to decrypt.</param>
 /// <returns>Decrypted hexadecimal data.</returns>
 private static string DESDecrypt(DESKey key, String data)
 {
     return(DESDecrypt(key.FirstKeyPart.ToString().HexToByteArray(), data.HexToByteArray()).ByteArrayToHex());
 }