This repository has been archived on 2022-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
bookmark-manager/RyzStudio/String.cs

36 lines
885 B
C#
Raw Normal View History

2017-07-30 11:59:34 +00:00
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace RyzStudio
{
public class String
{
public static string EncodeTo64(string value)
{
try
{
byte[] toEncodeAsBytes = System.Text.ASCIIEncoding.ASCII.GetBytes(value);
return System.Convert.ToBase64String(toEncodeAsBytes);
}
catch
{
return string.Empty;
}
}
public static string DecodeFrom64(string value)
{
try
{
byte[] encodedDataAsBytes = System.Convert.FromBase64String(value);
return System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
}
catch
{
return string.Empty;
}
}
}
}