Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Decrypt Encrypt
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Security.Cryptography; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); string userPassword ="6523"; Console.WriteLine("user Password "+userPassword); string encryptPassword = CryptoEngine.Encrypt(userPassword, "TjWnZr4u7x!A%D*G"); Console.WriteLine("encryptPassword "+encryptPassword); string decryptPassword = CryptoEngine.Decrypt(encryptPassword, "TjWnZr4u7x!A%D*G"); Console.WriteLine("decryptPassword "+decryptPassword); } } public class CryptoEngine { public static string Encrypt(string input, string key) { byte[] inputArray = UTF8Encoding.UTF8.GetBytes(input); TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider(); tripleDES.Key = UTF8Encoding.UTF8.GetBytes(key); tripleDES.Mode = CipherMode.ECB; tripleDES.Padding = PaddingMode.PKCS7; ICryptoTransform cTransform = tripleDES.CreateEncryptor(); byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length); tripleDES.Clear(); return Convert.ToBase64String(resultArray, 0, resultArray.Length); } public static string Decrypt(string input, string key) { byte[] inputArray = Convert.FromBase64String(input); TripleDESCryptoServiceProvider tripleDES = new TripleDESCryptoServiceProvider(); tripleDES.Key = UTF8Encoding.UTF8.GetBytes(key); tripleDES.Mode = CipherMode.ECB; tripleDES.Padding = PaddingMode.PKCS7; ICryptoTransform cTransform = tripleDES.CreateDecryptor(); byte[] resultArray = cTransform.TransformFinalBlock(inputArray, 0, inputArray.Length); tripleDES.Clear(); return UTF8Encoding.UTF8.GetString(resultArray); } } }
run
|
edit
|
history
|
help
0
Remove Duplicate Ignore Case
sktieritjre
Types
golestanali
Intuit // C# // listing_4.3 (StreamWriter // output.txt)
Math 9.3
CommandForce
decimal to multiple binary
Amortizacion de prestamos con el metodo Frances
GYT