On 5/17/2020 6:40 AM, Liu, Changcheng wrote:
On 10:27 Sun 17 May, Yehuda Sadeh-Weinraub wrote:
On Sat, May 16, 2020 at 4:33 PM Liu, Changcheng <changcheng.liu@intel.com> wrote:
Hi all, I'm trying to accelerate base64 encode/decode in Ceph.
Why do we implement it in this way? Which version of base64 RFC is followd by Ceph?
It is common to have base64 strings that have line breaks in them, so our decoding function needs to be able to handle that whether we use it or not. We do have ceph_armor_line_break() that can be used in theory (although it's not being used right now). There are cases where we need to handle base64 strings that were encoded by external sources, so code needs to be resilient and handle these cases.
Could you show which acutal usage needs to decode the '\n' in the encoded base64 string? Which base64 RFC is followd by Ceph? What's extra changes are added based the standard used RFC?
This seems like a very strange thing to focus on. The Ceph utility routine has the capability to add line breaks if requested; so far, the callers inside ceph do not add line breaks, but they could if desired. The code also ignores line breaks on input. This is just a normal coding decision, as the newline itself (or indeed any whitespace) is not part of the coding domain. Why do you find this to be an issue that requires attention?