4

I need to convert an array of bytes to another base, namely 85. In math terms the question is how to convert from base-256 to base-85 in the most efficient way?

This question is inspired by my previous question - What is the most efficient way to encode an arbitrary GUID into readable ASCII (33-127)?

Thanks.

Community
  • 1
  • 1
mark
  • 59,016
  • 79
  • 296
  • 580
  • Do you need something more efficient than converting from base 256 to base 10 and then to base 85 or are you looking for pointers on implementing this? – IVlad May 16 '10 at 08:21
  • Pointers are good enough. I would like to avoid intermediate results, like base-10. – mark May 16 '10 at 11:25

1 Answers1

1

You mean like this? http://www.codinghorror.com/blog/2005/10/c-implementation-of-ascii85.html

In silico
  • 51,091
  • 10
  • 150
  • 143
  • Looks like we did the same thing, only our input is always a byte array representing some guid, so we were able to optimize the solution by encoding two UInt64 values representing the guid into two 10 byte base-85 strings. But otherwise, this is the same code. Good to know. – mark May 16 '10 at 11:33