ietf-smtp
[Top] [All Lists]

Re: [ietf-smtp] quoted-unprintable ?

2021-03-26 02:34:05
On Thu, Mar 25, 2021 at 04:32:25PM -0700, Ned Freed wrote:

Any competent encryption scheme produces something close to uniformly
distributed output, which is about as good as you're going to get.

The second proposal actually analyzes the input, shifts characters around
to avoid the problematic cases, and selects a good quoting character.

Nothing nearly that sophisticaed is needed, if one is willing to keep it
simple and accept ~4.2% total cost (output folded to 78 bytes + CRLF).
In particular encryption really feels much too heavyweight.  And there
is a malicious counter-example in the form of binary data that happens
to be the decryption of a run of NULs. :-)

Instead, the COBS scheme generalises easily.  The encoding can be more
efficient if we e.g. chunk the output as 998 bytes + CRLF, in which case
the worst case expansion is 1.8% for an input stream entirely devoid of
NUL, LF or CR bytes.  This is the absolute worst case, not just for
likely, but all possible inputs, and inputs where all lines are 63 bytes
or less is not expanded at all!

On Thu, Mar 25, 2021 at 02:58:53PM -0400, Viktor Dukhovni wrote:

There's an easy generalisation to 3 forbidden code points: use 6 bits
for the chunk length, with 2 high bits for which of the 3 forbidden
sequences terminates the chunk.

    01 - NUL |
    10 - NL  | 6-bit byte count
    11 - CR  |

A non-zero value (n) of the 6-bit count indicates a run of (n-1) literal
bytes none of which are the reserved bytes NUL, LF or CR, followed by the
indicated reserved byte.  When (n == 0) the 2 high bits signal, respectively,
63, 126 or 189 literal bytes without a following reserved byte.

-- 
    Viktor.

_______________________________________________
ietf-smtp mailing list
ietf-smtp(_at_)ietf(_dot_)org
https://www.ietf.org/mailman/listinfo/ietf-smtp

<Prev in Thread] Current Thread [Next in Thread>