Exemplo n.º 1
0
 /// <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());
 }
Exemplo n.º 2
0
 /// <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());
 }