Base64 utility

I writing a shell script that need to decode base64 string.
Almost all linux distos have the base64 utility which is actually part of GNU coreutils package.
But on OpenWrt uses something other (busybox, right?) and doesn't have such utility.
I was wondered because actually the base64 algorithm is already implemented in libubox and is duplicated inside of uclient-fetch witch is an OpwnWrt specific clone of wget.
So it seems like it's almost a zero cost to just expose the base64 from libubox as a separate tool.
Is any reason not to do this? If yes then will you accept a patch.

Also for me is not clear why libubox have it's own base64 code (which looks like it was copied from OpenBSD) while we can just use the code from the GNU coreutils basenc.c which probably is better supported.
Sorry for such strange questions because I'm not a C/Linux dev so for me is not so obvious

Install coreutils-base64

1 Like

thank you, but I don't want to use it as dependency for my package because it's too heavy.
But the main question is:
why not to add such utility if this (I guess) will cost nothing in terms of disk usage

No reason to not do it. I think it was simply not done due to a lack of need. A patch would be welcome.

The libubox package is under ISC license, so we cannot import GPL code in to it.


Thank you for the reply. BTW I also found that the usign tools also have the base64 decoder which can be replaced with libubox;a=blob;f=base64.c;hb=HEAD

I recently learned BusyBox and starting from 31 release it already has base64 applet. Interesting if usign can reuse libbb or get base64.c from it.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.