using System;
      using System.Security.Cryptography;
      using System.Text;
      /// <summary>
      /// Dencrypts input string
      /// </summary>
      /// <param name="input">string to dencrypt</param>
      /// <returns>dencrypted result</returns>
      public static string Decrypt(string input, string encryption_key)
      	byte[] inputArray = Convert.FromBase64String(input);
        TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider();
        tripleDES.Key = UTF8Encoding.UTF8.GetBytes(encryption_key);
        tripleDES.Mode = CipherMode.ECB;
        tripleDES.Padding = PaddingMode.PKCS7;
        ICryptoTransform cTransform = tripleDES.CreateDecryptor();
        byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length);
        return UTF8Encoding.UTF8.GetString(resultArray);
      Csharp language logo

      Decrypt String


      Static function to dencrypt a string passed as parameter. It requires a dencription key as well.


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.