netutils/codecs/base64.c: Add base64_[de|en]code_length() API
This commit is contained in:
parent
4d2f580568
commit
557cd8e454
@ -68,8 +68,10 @@ extern "C"
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_CODECS_BASE64
|
||||
size_t base64_encode_length(size_t len);
|
||||
FAR void *base64_encode(FAR const void *src, size_t len, FAR void *dst,
|
||||
FAR size_t *out_len);
|
||||
size_t base64_decode_length(size_t len);
|
||||
FAR void *base64_decode(FAR const void *src, size_t len, FAR void *dst,
|
||||
FAR size_t *out_len);
|
||||
FAR void *base64w_encode(FAR const void *src, size_t len, FAR void *dst,
|
||||
|
@ -256,6 +256,15 @@ static char *_base64_decode(FAR const char *src, size_t len, FAR char *dst,
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: base64_encode_length
|
||||
****************************************************************************/
|
||||
|
||||
size_t base64_encode_length(size_t len)
|
||||
{
|
||||
return (len + 2) / 3 * 4;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: base64_encode
|
||||
****************************************************************************/
|
||||
@ -266,6 +275,15 @@ FAR void *base64_encode(FAR const void *src, size_t len, FAR void *dst,
|
||||
return _base64_encode(src, len, dst, out_len, false);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: base64_decode_length
|
||||
****************************************************************************/
|
||||
|
||||
size_t base64_decode_length(size_t len)
|
||||
{
|
||||
return len * 3 / 4;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: base64_decode
|
||||
****************************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user