@@ -45,8 +45,9 @@ namespace hmac_cpp {
4545 // / \param out Output byte vector (overwritten).
4646 // / \param alphabet Standard ("+/") or URL-safe ("-_") alphabet.
4747 // / \param require_padding If true, input must have proper '=' padding and length % 4 == 0.
48- // / \param strict If true, disallow whitespaces and enforce '=' only in the last quartet.
49- // / If false, ignore ASCII spaces and CR/LF/TAB and allow missing padding.
48+ // / \param strict If true, disallow whitespace and require '=' only in the last quartet.
49+ // / If false, ignore ASCII spaces/CR/LF/TAB, allow missing padding, and
50+ // / accept mixed "+/" and "-_" when \p alphabet == Url.
5051 // / \return true on success, false on invalid input.
5152 HMAC_CPP_API bool base64_decode (const std::string& in, std::vector<uint8_t >& out,
5253 Base64Alphabet alphabet = Base64Alphabet::Standard,
@@ -67,7 +68,7 @@ namespace hmac_cpp {
6768 // / \param data Pointer to input bytes.
6869 // / \param len Number of input bytes.
6970 // / \param pad If true, append '=' padding to a multiple of 8 chars.
70- // / \return Encoded string (upper-case).
71+ // / \return Encoded string (upper-case alphabet ).
7172 HMAC_CPP_API std::string base32_encode (const uint8_t * data, size_t len,
7273 bool pad = true );
7374
@@ -85,8 +86,8 @@ namespace hmac_cpp {
8586 // / \param in Input string (Base32; upper-case preferred).
8687 // / \param out Output byte vector (overwritten).
8788 // / \param require_padding If true, input must have proper '=' padding and length % 8 == 0.
88- // / \param strict If true, disallow whitespaces and lower-case; enforce '=' only in the last block.
89- // / If false, ignore ASCII spaces and CR/LF/TAB and accept lower-case letters.
89+ // / \param strict If true, disallow whitespace and lower-case; enforce '=' only in the last block.
90+ // / If false, ignore ASCII spaces/ CR/LF/TAB and accept lower-case letters.
9091 // / \return true on success, false on invalid input.
9192 HMAC_CPP_API bool base32_decode (const std::string& in, std::vector<uint8_t >& out,
9293 bool require_padding = false ,
@@ -97,6 +98,37 @@ namespace hmac_cpp {
9798 bool require_padding = false ,
9899 bool strict = true ) noexcept ;
99100
101+ // -------------------------
102+ // Base36 — encode / decode
103+ // -------------------------
104+
105+ // / \brief Base36-encode a byte buffer (digits 0–9, letters A–Z).
106+ // / Leading zero bytes are preserved by prefixing '0'.
107+ // / Input of a single \x00 returns "0".
108+ // / \param data Pointer to input bytes (big-endian).
109+ // / \param len Number of input bytes.
110+ // / \return Encoded string.
111+ HMAC_CPP_API std::string base36_encode (const uint8_t * data, size_t len);
112+
113+ // / \brief Base36-encode a vector.
114+ inline std::string base36_encode (const std::vector<uint8_t >& v) {
115+ return base36_encode (v.data (), v.size ());
116+ }
117+
118+ // / \brief Base36-encode a secure_buffer.
119+ inline std::string base36_encode (const secure_buffer<uint8_t >& v) {
120+ return base36_encode (v.data (), v.size ());
121+ }
122+
123+ // / \brief Decode a Base36 string.
124+ // / \param in Input string (case-insensitive).
125+ // / \param out Output byte vector (overwritten).
126+ // / \return true on success, false on invalid input.
127+ HMAC_CPP_API bool base36_decode (const std::string& in, std::vector<uint8_t >& out) noexcept ;
128+
129+ // / \brief Decode Base36 into secure_buffer.
130+ HMAC_CPP_API bool base36_decode (const std::string& in, secure_buffer<uint8_t >& out) noexcept ;
131+
100132} // namespace hmac_cpp
101133
102134#endif // _HMAC_ENCODING_HPP_INCLUDED
0 commit comments