I have two methods, where I need to convert string to base64 at begin and reverse this operation at the end. Problem is when my input string lenght is not divisible by 4 an conversion method throws exception.
public class Hashing
{
    public string Encrypt(string encrypted)
    {
        byte[] byteData = Convert.FromBase64String(encrypted);
        byte[] byteResult = Encrypt(byteData); // pt.1
        return Convert.ToBase64String(byteResult);
    }
    public string Decrypt(string decrypted)
    {
        byte[] byteData = Convert.FromBase64String(decrypted);
        byte[] byteResult = Decrypt(byteData); //pt.2
        return Convert.ToBase64String(byteResult);
    }
    /*
    ...
    */
}
class Program
{
    static void Main(string[] args)
    {
        Hashing cryptographyContext = new Hashing();
        var cryptoTest = "123456789"; //someStringThatNotGonnaBeConverted;
        string enc = cryptographyContext.Encrypt(password);
        string dec = cryptographyContext.Decrypt(enc);
        Console.WriteLine(dec);
        Console.ReadLine();
    }
}
Problem is I need base64 format at input of Decrypt and Encrypt methods (these at pt. 1 and 2) And I need returning strings from these methods. Do someone have an idea how to workaround this behaviour?
 
    