using System.Security.Cryptography;
public static void Main()
Console.WriteLine(CreateSerial("Hello World"));
private string CreateSerial(string input)
string passPhrase = "Adv@nceU5er";
string saltValue = "U5erAdv@nce";
string hashAlgorithm = "SHA1";
int passwordIterations = 2;
string initVector = "@1B2c3D4e5F6g7H8";
return Encrypt(input, passPhrase, saltValue, hashAlgorithm, passwordIterations, initVector, keySize);
public string Encrypt(string plainText, string passPhrase, string saltValue, string hashAlgorithm, int passwordIterations, string initVector, int keySize)
byte[] bytes = Encoding.ASCII.GetBytes(initVector);
byte[] bytes2 = Encoding.ASCII.GetBytes(saltValue);
byte[] array = Encoding.ASCII.GetBytes(plainText);
PasswordDeriveBytes passwordDeriveBytes = new PasswordDeriveBytes(passPhrase, bytes2, hashAlgorithm, passwordIterations);
byte[] bytes3 = passwordDeriveBytes.GetBytes((int) Math.Round((double) keySize/8.0));
ICryptoTransform transform = new RijndaelManaged
}.CreateEncryptor(bytes3, bytes);
MemoryStream memoryStream = new MemoryStream(array);
CryptoStream cryptoStream = new CryptoStream(memoryStream, transform, CryptoStreamMode.Read);
byte[] array2 = new byte[array.Length + 1];
string @string = Convert.ToBase64String(array2);