Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private string Encrypt(string Input, int TranslationValue = 5)
- {
- string Encrypted = "";
- Input = Input.ToLower();
- for (int i = 0; i <= Input.Length - 1; i++)
- {
- int CharNum = FindCharLocation(Input[i]);
- if (CharNum != -1)
- {
- if (CharNum >= Alphabet.Length - TranslationValue)
- {
- Encrypted += Alphabet[TranslationValue - (Alphabet.Length - CharNum)];
- }
- else
- {
- Encrypted += Alphabet[CharNum + TranslationValue];
- }
- }
- else
- {
- Encrypted += Input[i];
- }
- }
- return Encrypted;
- }
- private string Decrypt(string Input, int TranslationValue = 5)
- {
- string Decrypted = "";
- Input = Input.ToLower();
- for (int i = 0; i <= Input.Length - 1; i++)
- {
- int CharNum = FindCharLocation(Input[i]);
- if (CharNum != -1)
- {
- if (CharNum < TranslationValue)
- {
- Decrypted += Alphabet[Alphabet.Length - (TranslationValue - CharNum)];
- }
- else
- {
- Decrypted += Alphabet[CharNum - TranslationValue];
- }
- }
- else
- {
- Decrypted += Input[i];
- }
- }
- return Decrypted;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement