diff --git a/c#/CaesarLib/Caesar.cs b/c#/CaesarLib/Caesar.cs index a4e7698..105d4ae 100644 --- a/c#/CaesarLib/Caesar.cs +++ b/c#/CaesarLib/Caesar.cs @@ -24,5 +24,23 @@ static public string Encrypt(string text, int shift) } return message; } + + /// + /// decrypt string using Caesar Cipher + /// + /// string to decrypt + /// Shift by how many letters + /// decrypted string + static public string Decrypt(string text, int shift) + { + string message = null; + for (int i = 0; i < text.Length; i++) + { + int ASCII = (int)text[i]; + message += (char)(ASCII - shift); + } + + return message; + } } }