Ruby Padding Issues with Base64 Decoding
blog.vidyard.com
blog.vidyard.com
Why is it that the encoded string needs to be divisible by four before you can decode it?
This doesn't make it impossible to decode less than 4 characters, but you can't tell if the shortage is due to an error (early truncation) or just the padding being stripped (the article doesn't make it clear, but = is the traditional padding character used to make the encoded text have the proper length). Obviously both encoder/decoder will need to agree on the padding style to be used if it is important that encoded text be canonical.