Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
Updated Crypt methods (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
lpeyr committed Apr 3, 2022
1 parent d156685 commit dbe16c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions LeoCorpLibrary.Core/Crypt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public static string Encrypt(string source, string key)
throw new ArgumentNullException(nameof(source), "The string cannot be null.");
}

using (TripleDESCryptoServiceProvider tripleDESCryptoService = new TripleDESCryptoServiceProvider())
using (var tripleDESCryptoService = TripleDES.Create())
{
using (MD5CryptoServiceProvider hashMD5Provider = new MD5CryptoServiceProvider()) // Create MD5CryptoServiceProvider
using (var hashMD5Provider = MD5.Create()) // Create MD5CryptoServiceProvider
{
byte[] byteHash = hashMD5Provider.ComputeHash(Encoding.UTF8.GetBytes(key));
tripleDESCryptoService.Key = byteHash;
Expand All @@ -74,9 +74,9 @@ public static string Decrypt(string encrypt, string key)
throw new ArgumentNullException(nameof(encrypt), "The string cannot be null.");
}

using (TripleDESCryptoServiceProvider tripleDESCryptoService = new TripleDESCryptoServiceProvider())
using (var tripleDESCryptoService = TripleDES.Create())
{
using (MD5CryptoServiceProvider hashMD5Provider = new MD5CryptoServiceProvider()) // Create MD5CryptoServiceProvider
using (var hashMD5Provider = MD5.Create()) // Create MD5CryptoServiceProvider
{
byte[] byteHash = hashMD5Provider.ComputeHash(Encoding.UTF8.GetBytes(key));
tripleDESCryptoService.Key = byteHash;
Expand Down

0 comments on commit dbe16c5

Please sign in to comment.