Harcrack

hkqldap.CR

Feb 16th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.94 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Security.Cryptography;
  4. using System.Text;
  5.  
  6. public class CR
  7. {
  8.     private const string K = "667912";
  9.  
  10.     private const string I = "1L1SA61493DRV53Z";
  11.  
  12.     private const string SA = "1313Rf99";
  13.  
  14.     public static string DS(string EncryptedString)
  15.     {
  16.         if (string.IsNullOrEmpty(EncryptedString))
  17.         {
  18.             return string.Empty;
  19.         }
  20.         return RD(EncryptedString, "667912", "1313Rf99", 3, "1L1SA61493DRV53Z", 256);
  21.     }
  22.  
  23.     public static string ES(string PlainString)
  24.     {
  25.         if (string.IsNullOrEmpty(PlainString))
  26.         {
  27.             return string.Empty;
  28.         }
  29.         return RE(PlainString, "667912", "1313Rf99", 3, "1L1SA61493DRV53Z", 256);
  30.     }
  31.  
  32.     private static string RE(string plainText, string passPhrase, string saltValue, int passwordIterations, string initVector, int keySize)
  33.     {
  34.         //Discarded unreachable code: IL_00b9
  35.         byte[] bytes = Encoding.ASCII.GetBytes(initVector);
  36.         byte[] bytes2 = Encoding.ASCII.GetBytes(saltValue);
  37.         byte[] bytes3 = Encoding.ASCII.GetBytes(plainText);
  38.         Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(passPhrase, bytes2, passwordIterations);
  39.         byte[] bytes4 = rfc2898DeriveBytes.GetBytes(checked((int)Math.Round((double)keySize / 8.0)));
  40.         AesCryptoServiceProvider aesCryptoServiceProvider = new AesCryptoServiceProvider();
  41.         aesCryptoServiceProvider.Mode = CipherMode.CBC;
  42.         ICryptoTransform transform = aesCryptoServiceProvider.CreateEncryptor(bytes4, bytes);
  43.         using (MemoryStream memoryStream = new MemoryStream())
  44.         {
  45.             using (CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Write))
  46.             {
  47.                 cryptoStream.Write(bytes3, 0, bytes3.Length);
  48.                 cryptoStream.FlushFinalBlock();
  49.                 byte[] inArray = memoryStream.ToArray();
  50.                 memoryStream.Close();
  51.                 cryptoStream.Close();
  52.                 return Convert.ToBase64String(inArray);
  53.             }
  54.         }
  55.     }
  56.  
  57.     private static string RD(string cipherText, string passPhrase, string saltValue, int passwordIterations, string initVector, int keySize)
  58.     {
  59.         byte[] bytes = Encoding.ASCII.GetBytes(initVector);
  60.         byte[] bytes2 = Encoding.ASCII.GetBytes(saltValue);
  61.         byte[] array = Convert.FromBase64String(cipherText);
  62.         Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes(passPhrase, bytes2, passwordIterations);
  63.         checked
  64.         {
  65.             byte[] bytes3 = rfc2898DeriveBytes.GetBytes((int)Math.Round((double)keySize / 8.0));
  66.             AesCryptoServiceProvider aesCryptoServiceProvider = new AesCryptoServiceProvider();
  67.             aesCryptoServiceProvider.Mode = CipherMode.CBC;
  68.             ICryptoTransform transform = aesCryptoServiceProvider.CreateDecryptor(bytes3, bytes);
  69.             MemoryStream memoryStream = new MemoryStream(array);
  70.             CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
  71.             byte[] array2 = new byte[array.Length + 1];
  72.             int count = cryptoStream.Read(array2, 0, array2.Length);
  73.             memoryStream.Close();
  74.             cryptoStream.Close();
  75.             return Encoding.ASCII.GetString(array2, 0, count);
  76.         }
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment