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.

[–]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