G
Guest
Hi,
Have a symmetric encryption method that returns a base64 string. I then get
the hex representation of that string with the code below
public static string Base64ToHex(string input)
{
StringBuilder sb = new StringBuilder();
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
foreach(byte b in inputBytes)
{
sb.Append(string.Format("{0:x2}", b));
}
return sb.ToString();
}
My question is: How do I get the hex string back to base64 string?
Ex.
base64: NuZ5uF0MHtJ54nMc+79t/NR9GAmmaY3vUJu7fZyvww0=
hexfrombase64: 4e755a357546304d48744a35346e4d632b3739742f4e523947416d6d6159
3376554a7537665a79767777303d
base64fromhex: NuZ5uF0MHtJ54nMc+79t/NR9GAmmaY3vUJu7fZyvww0=
Have a symmetric encryption method that returns a base64 string. I then get
the hex representation of that string with the code below
public static string Base64ToHex(string input)
{
StringBuilder sb = new StringBuilder();
byte[] inputBytes = Encoding.UTF8.GetBytes(input);
foreach(byte b in inputBytes)
{
sb.Append(string.Format("{0:x2}", b));
}
return sb.ToString();
}
My question is: How do I get the hex string back to base64 string?
Ex.
base64: NuZ5uF0MHtJ54nMc+79t/NR9GAmmaY3vUJu7fZyvww0=
hexfrombase64: 4e755a357546304d48744a35346e4d632b3739742f4e523947416d6d6159
3376554a7537665a79767777303d
base64fromhex: NuZ5uF0MHtJ54nMc+79t/NR9GAmmaY3vUJu7fZyvww0=