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?
-
1http://stackoverflow.com/questions/641361/base32-decoding – Random Aug 11 '11 at 08:04
-
@m.edmondson, i didn't decoded it. I only got the decoded string, someone else decoded it. – aharon Aug 11 '11 at 08:13
-
@Random, I get an arry of bytes with the function FromBase64... I have just remembered that there is a function WriteAllBytes... – aharon Aug 11 '11 at 08:14
-
You should have specified `Base32`, or `Base64`, not `64bit` & `32bit` – Momoro Oct 30 '19 at 20:48
2 Answers
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

- 421
- 3
- 5
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

- 156
- 1
- 6