C# implementation of ASCII85

As promised, here is my C# implementation of the ASCII85 algorithm. This code is a loose port of the C sample referenced from the Wikipedia page. It's too much code to paste into a single entry, so I packaged it as a VS.NET 2003 solution -- using Clean Sources Plus, of course!

This includes both encoding and decoding, with reasonable data validation and a few minor options. Here's a quick list of the public methods:

Encode(byte[] ba)
Decode(string s)

And a handful of properties:

EnforceMarks (bool)
LineLength (int)
PrefixMark (string)
SuffixMark (string)

The sample app includes a basic test harness which tests string and binary file encoding, as well as some bad data scenarios. Here's the default demo running against the vaguely creepy Wikipedia slogan:

C# console app output

Of course, converting printable text to, er.. printable text.. isn't exactly an earth-shattering demo. Normally you'd be doing this on some kind of real binary data, as in the GUID.ToByteArray() example.

Read more

Stay Gold, America

We are at an unprecedented point in American history, and I'm concerned we may lose sight of the American Dream.

By Jeff Atwood · · Comments

The Great Filter Comes For Us All

With a 13 billion year head start on evolution, why haven't any other forms of life in the universe contacted us by now? (Arrival is a fantastic movie. Watch it, but don't stop there - read the Story of Your Life novella it was based on

By Jeff Atwood · · Comments

I Fight For The Users

If you haven't been able to keep up with my blistering pace of one blog post per year, I don't blame you. There's a lot going on right now. It's a busy time. But let's pause and take a moment

By Jeff Atwood · · Comments

The 2030 Self-Driving Car Bet

It's my honor to announce that John Carmack and I have initiated a friendly bet of $10,000* to the 501(c)(3) charity of the winner’s choice: By January 1st, 2030, completely autonomous self-driving cars meeting SAE J3016 level 5 will be commercially available for passenger

By Jeff Atwood · · Comments