Advertisement
Meliodas0_0

Ecrypt Decrypt

Nov 3rd, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1.  public static string IV = "1a1a1a1a1a1a1a1a";
  2.         public static string Key = "1a1a1a1a1a1a1a1a1a1a1a1a1a1a1a13";
  3.  
  4.         public static string Encrypt(string decrypted)
  5.         {
  6.             byte[] textbytes = ASCIIEncoding.ASCII.GetBytes(decrypted);
  7.             AesCryptoServiceProvider endec = new AesCryptoServiceProvider();
  8.             endec.BlockSize = 128;
  9.             endec.KeySize = 256;
  10.             endec.IV = ASCIIEncoding.ASCII.GetBytes(IV);
  11.             endec.Key = ASCIIEncoding.ASCII.GetBytes(Key);
  12.             endec.Padding = PaddingMode.PKCS7;
  13.             endec.Mode = CipherMode.CBC;
  14.             ICryptoTransform icrypt = endec.CreateEncryptor(endec.Key, endec.IV);
  15.             byte[] enc = icrypt.TransformFinalBlock(textbytes, 0, textbytes.Length);
  16.             icrypt.Dispose();
  17.             return Convert.ToBase64String(enc);
  18.         }
  19.  
  20.         public static string Decrypted(string encrypted)
  21.         {
  22.             byte[] textbytes = Convert.FromBase64String(encrypted);
  23.             AesCryptoServiceProvider endec = new AesCryptoServiceProvider();
  24.             endec.BlockSize = 128;
  25.             endec.KeySize = 256;
  26.             endec.IV = ASCIIEncoding.ASCII.GetBytes(IV);
  27.             endec.Key = ASCIIEncoding.ASCII.GetBytes(Key);
  28.             endec.Padding = PaddingMode.PKCS7;
  29.             endec.Mode = CipherMode.CBC;
  30.             ICryptoTransform icrypt = endec.CreateDecryptor(endec.Key, endec.IV);
  31.             byte[] enc = icrypt.TransformFinalBlock(textbytes, 0, textbytes.Length);
  32.             icrypt.Dispose();
  33.             return System.Text.ASCIIEncoding.ASCII.GetString(enc);
  34.         }
  35.  
  36.                 var sw = new StreamWriter(".\\RedExploit-Data\\RedExploit.Key");
  37.                 string enctxt = Encrypt(".\\RedExploit - Data\\RedExploit.Key");
  38.                 sw.WriteLine(enctxt);
  39.                 sw.Close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement