maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #06297
Re: Review of base64.diff and german2.diff
Hi!
>>>>> "Alexander" == Alexander Barkov <bar@xxxxxxxxxxx> writes:
Alexander> Hi Monty,
Alexander> On 09/17/2013 08:12 PM, Michael Widenius wrote:
<cut>
Alexander> I added a reference to http://en.wikipedia.org/wiki/Base64,
Alexander> as well all added these your comments in proper places of the code.
>>
>> Thanks. That will make the code much easier to understand.
>>
>> I just read trough the definition and noticed that some versions
>> doesn't use '=' padding.
>>
>> Should we allow not '=' padding in our decoder too?
>> (I think it's best to always pad on encoding).
Alexander> http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_to-base64
Alexander> says:
Alexander> > Different base-64 encoding schemes exist. These are the encoding and
Alexander> > decoding rules used by TO_BASE64() and FROM_BASE64():
Alexander> > ...
Alexander> > * Encoded output consists of groups of 4 printable characters. Each 3
Alexander> > bytes of the input data are encoded using 4 characters. If the last
Alexander> > group is incomplete, it is padded with '=' characters to a length of
Alexander> > 4.
Alexander> So we always pad on encoding.
This I tihnk is correct.
Alexander> So do most of the modern pieces of software.
Alexander> So does PHP:
Alexander> http://php.net/manual/en/function.base64-encode.php
Alexander> So does Linux "bas64" program:
Alexander> $ echo "123" |base64
Alexander> MTIzCg==
Alexander> This is why we always require pad characters on decoding.
This I don't necessary agree with.
One point of this function is to allow reading of coded text from
other programs, not only from mysqld. As some other programs are not
using padding, why would we not allow them ?
Alexander> I don't think we should accept not-padded values.
I still don't understand why?
What is the disadvantage in that ?
The only benefit I see of requiring padding on decoding is that we
have 30% change to find out if a message was 'not complete'.
The disadvantage is that we would have to somewhere document
that we don't support base64 coding from a set of programs.
What should we tell the users of these programs when/if they complain
that they can't use MariaDB to read their data?
<cut>
Regards,
Monty
References