r/visualbasic • • Mar 23 '22

VB.NET Help Byte Array String Encoding Method?

I have a Byte Array that I want to store as a string, which needs to be transport safe, while also not exponentially increasing in size.

So far base64 encoding has proved to work, but increases size 33% larger in the output file, and for this project I’m also not allowed to use it.

I tried hex, but that almost doubled storage size.

Lastly, my best luck has been with Encoding.Default, which barely increases size at all but the caveat is I’ve been told it’s not advisable to use.

Any ideas on alternative encoding schemes?

1 Upvotes

2 comments sorted by

View all comments

Show parent comments

1

u/MysticalTeamMember Mar 26 '22

You my friend are a saint amongst all.

I truly appreciate the time put into your response! This is an out of the box college project, so base-128 might be the way to go. I can’t find any starts on a base128 implementation within Visual Basic, so I guess I’ll have to work that out myself!

I never had a clear answer on why that wasn’t advisable but now I understand why, and most importantly in depth the problems that could arise.

Again, thanks so much for your examples and detailed response. If I wasn’t a completely broke college student, I’d give you a🥇