bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: base64 tool?


From: Eric Blake
Subject: Re: base64 tool?
Date: Tue, 28 Jun 2005 06:48:10 -0600
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Simon Josefsson on 6/27/2005 3:55 PM:
> 
> -w is for encoding, -i for decoding.  So they are orthogonal.  I
> thought about making -w affect decoding to, so decoding would ignore
> (only) newlines after COLS.  Could be fixed later on.

I would have suggested this as well; I like the thought of -w during
encoding adds newline at COL and at EOF, and -w during decoding ignores
newline only at COL and EOF.

As to your questions on other command line interfaces, I think base64
should at least behave as a filter:
base64 < file > file.b64
base64 -d < file.b64 > file

As for whether choosing on "base64 abc" whether abc is the filename
containing text to be encoded, or the actual text to be encoded, I would
lean towards filenames.  Consider that your typical input is arbitrary
length binary data, and passing that binary data directly as a command
line argument is not a typical usage of a textual command line interface.
 Besides, if you can easily type the input as an ASCII argument, why do
you need the 133% size penalty of encoding it?  For a single file, it
might make sense to support a -o/--output option to specify the name of
the output file.  Then "base64" would be equivalent to "base64 - -o -".
I'm not sure of the best approach for scaling it to multiple input or
output files, or if that is even necessary.

Does the RFC permit, recommend, or discourage \r\n line endings in base64
encodings?  Since the output is printable, you may want to consider
carefully the decision between opening the coded file in text vs. binary
modes on platforms where they are different.  The decoded file must
definitely be opened binary.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCwUcK84KuGfSFAYARAhpGAKDX2l8op0WgsDowuuZ0KjJ+RtryKACggnl4
ZyV/YWqKcZopXDJ1sGs08yY=
=vfDZ
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]