Commit Graph

4 Commits

Author SHA1 Message Date
Daniel J. Hofmann
e050f15cf8 Provide correct Base64 implementation.
Phew, this was painful. Turns out most hints out there on how to use the
Boost serialization iterators are wrong. Here's why:

    transform_width<6, 8>

needs an input stream of length: common multiple of 6 and 8.

That is, the padding needs to happen _before_ using the provided
iterators, otherwise the behavior is undefined!

See: http://www.boost.org/doc/libs/1_60_0/boost/archive/iterators/transform_width.hpp

Thanks @mokob for pointing that out to me!

We also need to manually add as many padding chars "=" to the encoded
result as many bytes we had to append to the input to conform to the
rule above.

Decoding then knows the number of padding chars by counting for "=" and
then using it in order to split off the last bytes from the decoded
result.
2016-03-31 18:58:52 +02:00
Daniel J. Hofmann
d0c534e5fa Completely re-write base64 logic, make API suck less in doing so 2016-03-31 18:58:52 +02:00
Daniel J. Hofmann
822bb97a5f RFC 4648 Test Vectors 2016-03-31 18:58:52 +02:00
Daniel J. Hofmann
6cd3b8bc00 Object Encoder -> Base64, kill false dependencies while doing so 2016-03-31 18:58:52 +02:00