Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion between Base64String and Hexadecimal

Tags:

c#

.net

hex

c++-cli

I use in my C++/CLI project ToBase64String to give a string like /MnwRx7kRZEQBxLZEkXndA== I want to convert this string to Hexadecimal representation, How I can do that in C++/CLI or C#?

like image 845
Aan Avatar asked Oct 16 '11 12:10

Aan


1 Answers

FromBase64String will take the string to bytes

byte[] bytes = Convert.FromBase64String(string s);

Then, BitConverter.ToString() will convert a byte array to a hex string ( byte[] to hex string )

string hex = BitConverter.ToString(bytes);
like image 118
bryanmac Avatar answered Sep 30 '22 11:09

bryanmac