MCPcopy Create free account
hub / github.com/defold/defold / Base64Encode

Function Base64Encode

engine/dlib/src/dlib/crypt_mbedtls.cpp:54–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52 }
53
54 bool Base64Encode(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t* dst_len)
55 {
56 size_t out_len = 0;
57 int r = mbedtls_base64_encode(dst, *dst_len, &out_len, src, src_len);
58 if (r != 0)
59 {
60 if (*dst_len == 0)
61 {
62 *dst_len = (uint32_t)out_len; // Seems to return 1 more than necessary, but better to err on the safe side! (see test_crypt.cpp)
63 }
64 else
65 {
66 *dst_len = 0xFFFFFFFF;
67 }
68 return false;
69 }
70 *dst_len = (uint32_t)out_len;
71 return true;
72 }
73
74 bool Base64Decode(const uint8_t* src, uint32_t src_len, uint8_t* dst, uint32_t* dst_len)
75 {

Callers 1

TESTFunction · 0.85

Calls 1

mbedtls_base64_encodeFunction · 0.85

Tested by 1

TESTFunction · 0.68