oath\_base32\_encode(3) liboath oath\_base32\_encode(3)

# [NAME](#NAME)

oath\_base32\_encode - API function

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;oath.h&gt;**

**int oath\_base32\_encode(const char * in, size\_t inlen, char \** out, size\_t * outlen);**

# [ARGUMENTS](#ARGUMENTS)

[const char * in](#const)

input string with binary data of length *inlen*

[size\_t inlen](#size_t)

length of input data *in*

[char \** out](#char)

pointer to newly allocated output string of length *outlen*, or NULL

[size\_t * outlen](#size_t~2)

pointer to output variable holding length of *out*, or NULL

# [DESCRIPTION](#DESCRIPTION)

Encode binary data into a string with base32 data.

The *in* parameter should contain *inlen* bytes of data to encode. The function allocates a new string in \**out* to hold the encoded data, and sets \**outlen* to the length of the data. The output string \**out* is zero-terminated (ASCII NUL), but the NUL is not counted in \**outlen*.

If *out* is NULL, then \**outlen* will be set to what would have been the length of \**out* on successful encoding.

If the caller is not interested in knowing the length of the output data *out*, then *outlen* may be set to NULL.

It is permitted but useless to have both *out* and *outlen* NULL.

# [RETURNS](#RETURNS)

On success **OATH\_OK** (zero) is returned, **OATH\_BASE32\_OVERFLOW** is returned if the output would be too large to store, and **OATH\_MALLOC\_ERROR** is returned on memory allocation errors.

# [SINCE](#SINCE)

1.12.0

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;oath-toolkit-help@nongnu.org&gt;. liboath home page: https://www.nongnu.org/oath-toolkit/ General help using GNU software: http://www.gnu.org/gethelp/

# [COPYRIGHT](#COPYRIGHT)

Copyright © 2009-2020 Simon Josefsson.  
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

2.6.12-dirty liboath

---

Document: oath_base32_encode(3) from oath-toolkit 2.6.12-r12 (Chainguard OS)
Source: https://gitlab.com/oath-toolkit/oath-toolkit.git
