public static string Caesar(string str)
string str2 = string.Empty;
for (int i = 0; i < str.Length; i++)
int p = Convert.ToInt32(str[i]);
if (str[i] > 'a' && str[i] < 'z')
if (str[i] > 'A' && str[i] < 'Z')
str2 += Convert.ToChar(a);
public static string deCaesar(string str)
string str2 = string.Empty;
for (int i = 0; i < str.Length; i++)
int p = Convert.ToInt32(str[i]);
if (str[i] > 'a' && str[i] < 'z')
if (str[i] > 'A' && str[i] < 'Z')
str2 += Convert.ToChar(a);
public static string rndABC()
string start = "abcdefghijklmnopqrstuvwxyz";
char[] arrStart = ("abcdefghijklmnopqrstuvwxyz").ToCharArray();
Random rnd = new Random();
for (int i = 0; i < start.Length; i++)
int j = rnd.Next(i, start.Length);
arrStart[i] = arrStart[j];
string arrFinal = string.Empty;
for (int i = 0; i < start.Length; i++)
public static string Permutacija(string str)
string str2 = string.Empty;
char[] arrBase = ("abcdefghijklmnopqrstuvwxyz").ToCharArray();
char[] arrKey = (rndABC()).ToCharArray();
for (int i = 0; i < str.Length; i++)
for (int j = 0; j < arrBase.Length; j++)
if (str[i] > 64 && str[i] < 91)
string basse = Convert.ToString(arrBase[j]);
if (str[i] == Convert.ToChar(basse.ToUpper()))
p = Convert.ToString(arrKey[j]).ToUpper();
if (str[i] > 96 && str[i] < 123 && str[i] == arrBase[j])
p = Convert.ToString(arrKey[j]);
public static string dePermutacija(string str)
string str2 = string.Empty;
string arrBase = "abcdefghijklmnopqrstuvwxyz";
string arrKey = rndABC();
for (int i = 0; i < str.Length; i++)
for (int j = 0; j < arrBase.Length; j++)
if (str[i] > 64 && str[i] < 91)
string key = Convert.ToString(arrKey[j]);
if (str[i] == Convert.ToChar(key.ToUpper()))
p = Convert.ToString(arrBase[j]).ToUpper();
if (str[i] > 96 && str[i] < 123 && str[i] == arrKey[j])
p = Convert.ToString(arrBase[j]);
public static void Main()
string s = Console.ReadLine();
Console.WriteLine("Prvo se cezarom dobije: ");
Console.WriteLine(Caesar(s));
Console.WriteLine("Zatim se permutacijom dobije: ");
Console.WriteLine("abcdefghijklmnopqrstuvwxyz");
Console.WriteLine(rndABC());
string n = Permutacija(Caesar(s));
Console.WriteLine("~~~~DESIFROVANJE~~~");
Console.WriteLine(dePermutacija(n));
Console.WriteLine(deCaesar(dePermutacija(n)));