support/BRBase58.c
// returns the number of characters written to str including NULL terminator, or total strLen needed if str is NULL
returns the number of characters written to str including NULL terminator, or total strLen needed if str is NULL
returns the number of characters written to str including NULL terminator or total strLen needed if str is NULL
size_t BRBase58CheckEncode(char *str, size_t strLen, const uint8_t *data, size_t dataLen)
{
    size_t len = 0, bufLen = dataLen + 256/8;
    uint8_t _buf[0x1000], *buf = (bufLen <= 0x1000) ? _buf : malloc(bufLen);
    assert(buf != NULL);
    assert(data != NULL || dataLen == 0);
    if (data || dataLen == 0) {
        memcpy(buf, data, dataLen);
        BRSHA256_2(&buf[dataLen], data, dataLen);
        len = BRBase58Encode(str, strLen, buf, dataLen + 4);
    }
    mem_clean(buf, bufLen);
    if (buf != _buf) free(buf);
    return len;
}
size_t BRBase58CheckEncode ( char * str , size_t strLen , const uint8_t * data , size_t dataLen ) { size_t len = 0 , bufLen = dataLen + 256 / 8 ; uint8_t _buf [ 0x1000 ] , * buf = ( bufLen <= 0x1000 ) ? _buf : malloc ( bufLen ) ; assert ( buf != NULL ) ; assert ( data != NULL || dataLen == 0 ) ; if ( data || dataLen == 0 ) { memcpy ( buf , data , dataLen ) ; BRSHA256_2 ( & buf [ dataLen ] , data , dataLen ) ; len = BRBase58Encode ( str , strLen , buf , dataLen + 4 ) ; } mem_clean ( buf , bufLen ) ; if ( buf != _buf ) free ( buf ) ; return len ; }
returns the number of characters written to str including NULL terminator, or total strLen needed if str is NULL
returns the number of characters written to str including NULL terminator or total strLen needed if str is NULL