Bite my bytes

What I learn by day I blog at night - A blog from Microsoft Consultant working from Ljubljana, Slovenia

  Home :: Contact :: Syndication  
  999 Posts :: 7691 Comments :: 235 Trackbacks

Search

Most popular posts
in last 30 days

Categories

My Projects

Archives

Stuff


Copyright © by David Vidmar
 
Contact me!
 
LinkedIn Profile
 
 
 

One of the easies ways to store byte array in a text form, let's say in the text field of a database, is to use Base64 encoding. It's standard , it's easy and there is a nice support for it in .NET. Just use ToBase64String and FromBase64String.

Example:

byte[] cypherText =  enc.Encrypt(plainText, key);           
string sEncodedAndEncryptedText = Convert.ToBase64String(cypherText);
Posted on Wednesday, March 15, 2006 11:39 PM | Filed under: Developement |

Feedback

# re: ASCII encoding 3/16/2006 1:03 PM dejan
I see you are in cryptography. Base64 is also useful for transfering byte objects (documents, images, ...) to and from web services, although it adds about 30% of overhad.

# re: ASCII encoding 3/25/2006 9:50 AM Andrej Tozon
Dejan, Base64 is ok for your app - database communication, when using datasets or small data chunks. However, if I was to use web services to transfer larger binary objects, I'd consider WSE 3.0 and MTOM.

Comments have been closed on this topic.