As I understand the spec, a Base64 encoder
a) takes the source binary, and pads it out with zeroes to be a multiple of 24 bytes long.
b) it then transcodes it, six bits at a time, to the target set of 64 characters (A..Z, a..z, 0..9, +, -). If it finds the last two bytes (16 bits) have been zero-padded, the last two characters are transcoded as '=='. If it finds that the last one byte (8 bits) have been zero-padded, the last character is transcoded as '='.
My question is, in step (b), how does it know that the last bytes are zeroes because they have been padded vs. they are zeroes because thay are part of the valid binary source data?
Is it that the subsystem that is responsible for part (b) has to know what took place during part (a)