Sunday, September 25, 2011

C#: Decode base64 String

Last time I had an example of Encoding of string into base64. This time Decoding.

Below is the c# code block that will convert the provided base64 string into readable one. This c# code will first decode the base64 string into byte array. After that it will convert that byte array into String data.


// "hello world"
String stringData = "aGVsbG8gd29ybGQ=";
Byte[] byteData = Convert.FromBase64String(stringData);
stringData = Encoding.ASCII.GetString(byteData);
Console.WriteLine(stringData);

1 comment:

buyi wen said...

you can try this free online service to convert base64 to string online.

Get function name programaticaly - Python

This little piece of code will help you to get the function name programatically. This is very helpful when you are implementing the debug...