473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Base64 string from byte array - what's the length ratio ?

Hi All,

Does somebody know what's the length's ratio in we convert byte[] to base64
string? Is it a constant ratio or it can be different from case to case? For
example if I convert a byte array of 20 bytes length can I expect that I get
the base64 string with the same length every time when I do that? And what
will be the maximum length of this string?

What's the schema is taken for this conversion? If we use UUENCODE or
something else we can predict the string length converting a byte array. Can
we do the same in this case?

Regards,
Dmitri.
Nov 15 '05 #1
2 20666
http://msdn.microsoft.com/library/de...ing_base64.asp

"Dmitri Shvetsov" <ds*******@cox.net> wrote in message
news:5LhXa.34672$Ne.31005@fed1read03...
Hi All,

Does somebody know what's the length's ratio in we convert byte[] to base64 string? Is it a constant ratio or it can be different from case to case? For example if I convert a byte array of 20 bytes length can I expect that I get the base64 string with the same length every time when I do that? And what
will be the maximum length of this string?

What's the schema is taken for this conversion? If we use UUENCODE or
something else we can predict the string length converting a byte array. Can we do the same in this case?

Regards,
Dmitri.

Nov 15 '05 #2
Base64 encoding turns 3 bytes into 4 in the conversion.

Specifically, it encodes 6 bits into 8 bits, so looking at proper
boundaries, it takes 3 bytes to properly fence-post 6bit chunks. The
encoding then expands them to 8 bits to allow ascii representation of
non-ascii data (binary data) where applicable.

"Dmitri Shvetsov" <ds*******@cox.net> wrote in message news:<5LhXa.34672$Ne.31005@fed1read03>...
Hi All,

Does somebody know what's the length's ratio in we convert byte[] to base64
string? Is it a constant ratio or it can be different from case to case? For
example if I convert a byte array of 20 bytes length can I expect that I get
the base64 string with the same length every time when I do that? And what
will be the maximum length of this string?

What's the schema is taken for this conversion? If we use UUENCODE or
something else we can predict the string length converting a byte array. Can
we do the same in this case?

Regards,
Dmitri.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Magnus | last post by:
Hi, I'm programatically posting an image using multipart/form-data. It sends to the server OK, but when I try to view it in the browser, it is still in the base64 string I sent it as:...
6
by: Gator | last post by:
Hi All, Basically my situation is this, I have a server implemented in C++, unmanaged code, using proprietery protocol over TCP/IP to communicate with the cilent(c++ also). Now, I am implementing...
3
by: Nick | last post by:
I have found a class that compresses and uncompresses data but need some help with how to use part of it below is the deflate method which compresses the string that I pass in, this works OK. At...
1
by: sridev | last post by:
hi all, i have a byte array which has length of 10,000.I have to break this byte array into smaller parts of length 512 and save this values into another byte array. I am doing this because...
9
by: Jeremy Kitchen | last post by:
Are there any library functions that can help me to do this? If necessary I can convert the string to a byte array. I don't want to have to write my own Hex conversion if it isn't necessary. ...
3
by: Peted | last post by:
Is it possible to concatanate a string and a byte array, into a "string" variable, send it as a string to an ip socket device and have the bytes, seen as a sequence of bytes, not char or string ? ...
1
by: ankits | last post by:
Hello, My task is to send data packets on network. I've file which I have serialized by using Serialize() method of binaryformatter class and now I want to convert the file into array of bytes...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
5
by: smclellan86 | last post by:
Hi Everybody, I've been working on this challenge for a while now without much luck. What I'm attempting to do is split a MIME byte response into its individual images. I am given the boundary to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.