2018-03-06 12:06 GMT-03:00 Henrik Sperre Johansen <henrik.s.johansen@veloxit.no>:
Esteban A. Maringolo wrote
BaseX encode/decode can be simple enough to fit in a small workspace:
base := 58. base58Lookup := '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'. myNumber := 12345678901234567890.
myString := encode value: myNumber. (decode value: myString) = myNumber.
If you're encoding numbers to strings, and viceversa, that's ok. If you also need to support encoding strings (as bytearrays) that didn't work for me. I like your approach, it was more concise and didn't require reversing the output as the one i used [1]
The appeal of Base64 is it transforms the // and \\ operations into simple shifts / masks.
I guess, every bit and byte operation is simpler when happens in multiples of 8 :) Regards! [1] https://github.com/eMaringolo/pharo-base58/blob/master/src/Base58-Core.packa... Esteban A. Maringolo