first commit
This commit is contained in:
34
Classes/General.cs
Normal file
34
Classes/General.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace EFCDesk.Classes
|
||||
{
|
||||
public class General
|
||||
{
|
||||
public static string CodificarBase64(string cadena)
|
||||
{
|
||||
string resultado = cadena;
|
||||
string[] arrayLetras = { "J", "G", "V", "S" };
|
||||
int limite = arrayLetras.Length;
|
||||
Random random = new Random();
|
||||
int num = random.Next(0, limite);
|
||||
for (var i = 0; i <= num; i++)
|
||||
{
|
||||
resultado = Base64Encode(resultado);
|
||||
}
|
||||
resultado = resultado + "+" + arrayLetras[num];
|
||||
resultado = Base64Encode(resultado);
|
||||
return resultado;
|
||||
}
|
||||
|
||||
public static string Base64Encode(string plainText)
|
||||
{
|
||||
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
|
||||
return System.Convert.ToBase64String(plainTextBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user