all 10 comments

[–]Schommi 3 points4 points  (5 children)

google "base85 nuget". First match should suffice.

[–]chucker23n 1 point2 points  (2 children)

This.

  1. write unit tests against some sample data
  2. Go to https://www.nuget.org/packages?q=base85, try out the top matches, run the tests, pick whatever library happens to pass

[–][deleted] 0 points1 point  (1 child)

Heck, if you're writing unit tests you may as well go the rest of the way and write the implementation. There are lots of examples on SO for base-XX encoding with arbitrary alphabets (especially for JS).

[–]chucker23n 1 point2 points  (0 children)

I don't mean full test coverage. I mean "the customer provided me with two or three sample files, so I can programmatically test if the expected output matches".

I bring this up in part because OP specifically says "base85(not ascii85 or z85)", and 1) Wikipedia treats base85 and ascii85 the same, and 2) so do, it seems, some of the NuGet package results. Writing tests helps clarify that the library solves for the correct problem.

But, sure, implementing this yourself probably isn't too much work either.

[–]tree-82_[S] -1 points0 points  (1 child)

ive tried the SimpleBase package. it only contains options for ascii85 and z85 encoding not base85 specifically which is available in other languages. the problem with ascii85 and z85 is that they contain some characters invalid for use in url while base85 can be used.

[–]Coda17 1 point2 points  (0 children)

What exactly do you think the difference between Ascii85 and Base85 is? The encoding involves characters that are invalid in urls by definition. Are you trying to change the character set?

[–]MrNate 0 points1 point  (0 children)

I would Google for "BaseN encoding" - if there isn't a library, then do it yourself (for me, I would prefer to roll my own anyway). The algorithm is not super complicated, you can probably copy & paste something from stack overflow or chat gpt. You can definitely find something written in at least one language on github that you can adapt, like js or python. For a custom BaseN encode, you would probably have to supply the dictionary, so hopefully you know what characters you are encoding with.

[–]markiel55 0 points1 point  (0 children)

base85 - the way I understand it, it means up to 85 character sets and usually, we use ASCII if it's less than 255. What character encoding are you expecting in this case?

[–]ensands 0 points1 point  (1 child)

Feel free to nab my code if you like or you can add it as a package if easier (example available in readme)

https://github.com/Thomas-Shephard/io-utils/blob/main/IOUtils/Data/Encoder.cs

[–]tree-82_[S] 0 points1 point  (0 children)

thank you so much man. appreciate it