Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace Merokhaja.Service.Security
- {
- public static class CryptoUtilities
- {
- public static string EncryptString(string text)
- {
- string encrypted;
- try
- {
- byte[] b = System.Text.Encoding.ASCII.GetBytes(text);
- encrypted = Convert.ToBase64String(b);
- }
- catch (FormatException e)
- {
- encrypted = "";
- }
- return encrypted;
- }
- public static string DecryptString(string text)
- {
- byte[] b;
- string decrypted;
- try
- {
- b = Convert.FromBase64String(text);
- decrypted = System.Text.Encoding.ASCII.GetString(b);
- }
- catch (FormatException e)
- {
- decrypted = "";
- }
- return decrypted;
- }
- }
- }
Add Comment
Please, Sign In to add comment