Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best way to separate two base64 strings

Tags:

c#

base64

I am using standard input and output to pass 2 base64 strings from one application to another. What would be the best way separating them so I could get them as a two separate strings in other application? I was thinking using a simple comma, to separate them and then just use

string[] s = output.Split(',');

Where output is the data I read in from standard output.

Example with the comma:

MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCv5E5Y0Wrad5FrLjeUsA71Gipl3mhjIuCw1xhj jDwXN87lIhpE32UvItf+mvp8flQ+fhi5H0PditDCzUFg8lXuiuOXxelLWEXA8hs7jc+4zzR5ps3R fOv3M6H8K5XGkwWLhVNQX47sAGyY/43JdbfX7+FsYUFeHW/wa2yKSMZS3wIDAQAB ,HNJpFQyeyJoVbeEgkw/WNtzR0JTPIa1hlK1C8LbFcVcJfL33ssq3gbzi0zxn0n2WxBYKJZj2Kqbs lVrmFbQJRgvq4ZNF4F8z+xjL9RVVE/rk5x243c3Szh05Phzx+IUyXJe6GkITDmsxcwovvzSaGhzU 3qQkNbhIN0fVyynpg0Kfm0WytuW71ku1eq45ibcczgwQLRJX1GKzC9wH7x/V36i6SpyrxZ/+uCIL 4QgnKt6x4QG7Gfk3Msam6h6JTFdzkeHJjq6JzeapdQn5LxeMY0jLGc4cadMCvy/Jdrcg02pG2wOO /gJT77xvX+d1igi+BQ/YpFlwXI0BIuRwMAeLojmZdRYjJ+LY69auxgpnQvSF4A+Wc6Jo8m1pzzHB yQvA8KyiRwbyijoBOsg+oK18UPFWeJ5hE3e+8l/WSEcii+oPgXyXTnK+seesGdOPeem3HukNyIps L/StHZEkzeJFTr8LIB9HLqDikYU2mQjTiK5cIExoyy2Go+0ndL84rCzMZAlfFlffocL9x+SGyeer M1mxmyDtmiQfDphEZixHOylciKUhWR00dhxkVRQ4Q9LYCeyGfDiewL+rm5se/ePCklWtTGycV9HM H5vYLhgIkf5W6+XcqcJlE6vp4WWxmKHQYqRAdfW5MYWskx7jBDTMV2MLy7N6gQRQa/OpK8ruAbVf MwWP1sGyhAxgrw/UxTH1tW498WI5JtQR3oub3+Uj5AqydhwzQtWM58WfVQXdv2bFZmGH7d9A+C95 DQ8QXKrV7Ot/wVq5KKLgpJy8iMe/G/iyXOmQhkLnZ3qvBaIJd+E2ZIVPty6XGMwgC4JebArr+a6V Cb/SO+vR+eZmXLln/w==

like image 330
hs2d Avatar asked Mar 18 '11 10:03

hs2d


People also ask

Can Base64 be cracked?

Your provider has to tell you the encryption algorithm and key. From the length of the base64 representation, it could be pretty much anything. Yet, as the other answer correctly said, you have no chance anyone can crack this for you here; without a key and the encryption method you will not get hold of the data.

Why do Base64 strings end with ==?

From Wikipedia: The final '==' sequence indicates that the last group contained only one byte, and '=' indicates that it contained two bytes.

What does == mean in Base64?

When decoding Base64 text, four characters are typically converted back to three bytes. The only exceptions are when padding characters exist. A single = indicates that the four characters will decode to only two bytes, while == indicates that the four characters will decode to only a single byte. For example: Encoded.

How do I decompress Base64?

To decode a file with contents that are base64 encoded, you simply provide the path of the file with the --decode flag. As with encoding files, the output will be a very long string of the original file. You may want to output stdout directly to a file.


2 Answers

All you have to do is to use a separator which is not a valid Base64 character. Comma is not a base64 character so you can use.

Base64 characters are [0-9a-zA-Z/=+] (all numbers, uppercase, lowercase, forward slash plus and equal sign).

like image 102
Aliostad Avatar answered Sep 23 '22 10:09

Aliostad


This seems like a good solution. The comma cannot be part of a base64 index table so it is a safe separator.

like image 39
Darin Dimitrov Avatar answered Sep 22 '22 10:09

Darin Dimitrov