Created
March 28, 2014 18:59
-
-
Save angelobelchior/9840396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
namespace Cryptography | |
{ | |
public class Base64 | |
{ | |
public static string Encrypt(string text) | |
{ | |
Throw.IfIsNullOrEmpty(text); | |
byte[] toEncodeAsBytes = ASCIIEncoding.ASCII.GetBytes(text); | |
string returnValue = Convert.ToBase64String(toEncodeAsBytes); | |
return returnValue; | |
} | |
public static string Decrypt(string text) | |
{ | |
Throw.IfIsNullOrEmpty(text); | |
byte[] encodedDataAsBytes = Convert.FromBase64String(text); | |
string returnValue = ASCIIEncoding.ASCII.GetString(encodedDataAsBytes); | |
return returnValue; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment