-1

I have a zip file decoded in base 64bit (it's a string). I want to take that string, convert it to 32bit and create the zip file. How can i do it?

aharon
  • 7,393
  • 10
  • 38
  • 49

2 Answers2

2

Edited. Check out http://www.atrevido.net/blog/2004/01/13/Base32%2BIn%2BNET.aspx if you need a base32 representation of your bytes.

If you just need to create a zip file from at base64 encoded string, convert it to byte[] and write it to a zip stream:

byte[] bytes = Convert.FromBase64String(base64String); GZipStream stream.. stream.Write(bytes,0,bytes.length);

The base 64 string contains a representation of your bytes - it's not a 64 bit representation, it's a 64 characters representation: http://en.wikipedia.org/wiki/Base64

Ulrik Magnusson
  • 421
  • 3
  • 5
0

If you decoded a file in a String object, then you've got the work done. Now the string is represented by .NET runtime in some way you really should not care about. Maybe you have some constraint on character encoding, that is ASCII, utf-8, and so on. If that is the case, you can use Encoding class and its utility methods for conversion. Encoding.Convert() on MSDN

Ratman
  • 156
  • 1
  • 6