C Sharp - proste szyfrowanie
class crypt
{
protected string klucz = "nasz_Tajny_KLUCZ";
public string text = "";
public string tcrypt(string ptext)
{
int x = 0;
text = "";
int i = 0;
for (x = 0; x < ptext.Length; x++)
{
text += char.ToString((char)(ptext[x] + klucz[i]));
i++;
if (i == klucz.Length) i = 0;
}
return text;
}
public string tcrypt(string ptext, string pklucz)
{
int x = 0;
text = "";
int i = 0;
for (x = 0; x < ptext.Length; x++)
{
text += char.ToString((char)(ptext[x] + pklucz[i]));
i++;
if (i == pklucz.Length) i = 0;
}
return text;
}
public string tencrypt(string ptext)
{
int x = 0;
text = "";
int i = 0;
for (x = 0; x < ptext.Length; x++)
{
text += char.ToString((char)(ptext[x] - klucz[i]));
i++;
if (i == klucz.Length) i = 0;
}
return text;
}
public string tencrypt(string ptext, string pklucz)
{
int x = 0;
text = "";
int i = 0;
for (x = 0; x < ptext.Length; x++)
{
text += char.ToString((char)(ptext[x] - pklucz[i]));
i++;
if (i == pklucz.Length) i = 0;
}
return text;
}
}