using System;
using System.Text;

namespace FutureCore
{
    public static class Base64EncodeUtil
    {
        public static string Base64Encode(string source)
        {
            return Base64Encode(Encoding.UTF8, source);
        }

        public static string Base64Decode(string result)
        {
            return Base64Decode(Encoding.UTF8, result);
        }
        
        public static string Base64Encode(Encoding encoding, string source)
        {
            byte[] bytes = encoding.GetBytes(source);
            string encode = Convert.ToBase64String(bytes);
            return encode;
        }
        
        public static string Base64Decode(Encoding encoding, string result)
        {
            byte[] bytes = Convert.FromBase64String(result);
            string decode = encoding.GetString(bytes);
            return decode;
        }
    }
}