#ifndef __AMSSTRING4_BINTEXTENCODING_HPP__
#define __AMSSTRING4_BINTEXTENCODING_HPP__

namespace ams
{

//Only processes strings of length divisible by 4, with
//expected 0,1,2 padding chars at the end of the string,
//and no non-coding characters.
void base64encode(ams::amsarray<uint8_t> *bytes, amsstring *str);



int base64decode(amsstring *str, ams::amsarray<uint8_t> *bytes, bool bstrict);

//decodes, ignoring (as in MIME spec) all characters that are not
//valid b64 alphabet chars, and all padding until the end of the string
int base64decode_liberal(amsstring *str, ams::amsarray<uint8_t> *bytes);

int base64decode_strict(amsstring *str, ams::amsarray<uint8_t> *bytes);

void test_base64encode();
void test_base64encode_fuzztest();

};

#endif

