using Microsoft.VisualBasic;
using System.Collections.Generic;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows.Forms;
public static string mInsert(string source, int index, string text){
return source.Substring(0, index) + text + source.Substring(index);
public static string ReverseString(string s)
char[] array = new char[s.Length];
for (int i = s.Length - 1; i >= 0; i--)
return new string(array);
public static string Encrypt(string text, string key, int step)
string temp = String.Empty;
byte[] bytes = Encoding.ASCII.GetBytes(ReverseString(key));
for (int j=0;j<step;j++) {
temp += Convert.ToBase64String(bytes);
text = mInsert(text, step, temp);
text = ReverseString(text);
public static string Decrypt(string text, string key, int step)
string temp = String.Empty;
byte[] bytes = Encoding.ASCII.GetBytes(ReverseString(key));
for (int j=0;j<step;j++) {
temp += Convert.ToBase64String(bytes);
text = ReverseString(text);
return text.Replace(temp,"");
public static void Main()
string encrypted = Encrypt("SAMOTHEBESTHACKEREVER","LOLZ",3);
string decrypted = Decrypt(encrypted,"LOLZ",3);
Console.WriteLine("ENCRYPTED: " + encrypted);
Console.WriteLine("DECRYPTED: " + decrypted);