using System.Security.Cryptography;
public static class CryptMPM
private static string INIT_VECTOR = "aUCCRX775iuX2W2m";
private static string PASS_PHRASE = "mPmS0fTw4R3";
private static string SALT_VALUE = "H4rD3gU4r3";
public static string Decrypt(string value)
ICryptoTransform transform = null;
MemoryStream stream = null;
CryptoStream stream2 = null;
byte[] bytes = Encoding.ASCII.GetBytes(INIT_VECTOR);
byte[] rgbSalt = Encoding.ASCII.GetBytes(SALT_VALUE);
byte[] buffer = Convert.FromBase64String(value);
byte[] rgbKey = new PasswordDeriveBytes(PASS_PHRASE, rgbSalt, "SHA1", 2).GetBytes(0x20);
transform = new RijndaelManaged
Padding = PaddingMode.PKCS7
}.CreateDecryptor(rgbKey, bytes);
stream = new MemoryStream(buffer);
stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Read);
byte[] buffer5 = new byte[buffer.Length];
int count = stream2.Read(buffer5, 0, buffer5.Length);
str = Encoding.UTF8.GetString(buffer5, 0, count);
if ((stream2 != null) && (str != ""))
public static string Encrypt(string value)
PasswordDeriveBytes bytes = null;
ICryptoTransform transform = null;
MemoryStream stream = null;
CryptoStream stream2 = null;
byte[] rgbIV = Encoding.ASCII.GetBytes(INIT_VECTOR);
byte[] rgbSalt = Encoding.ASCII.GetBytes(SALT_VALUE);
byte[] buffer = Encoding.UTF8.GetBytes(value);
bytes = new PasswordDeriveBytes(PASS_PHRASE, rgbSalt, "SHA1", 2);
transform = new RijndaelManaged
Padding = PaddingMode.PKCS7
}.CreateEncryptor(bytes.GetBytes(0x20), rgbIV);
stream = new MemoryStream();
stream2 = new CryptoStream(stream, transform, CryptoStreamMode.Write);
stream2.Write(buffer, 0, buffer.Length);
stream2.FlushFinalBlock();
str = Convert.ToBase64String(stream.ToArray());
public static void Main()
Console.WriteLine(CryptMPM.Encrypt("volkswagen"));
Console.WriteLine(CryptMPM.Decrypt("wPOJvd0tuc46NOie/mv9TQ=="));
Console.WriteLine(CryptMPM.Encrypt("00064"));
Console.WriteLine(CryptMPM.Decrypt("L6wcrEQKjQnZSzc8qlb64Q=="));