Embedded SDK
Embedded SDK
Functions | Variables
base58.c File Reference
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include "base58.h"
Include dependency graph for base58.c:

Go to the source code of this file.

Functions

int base58_decode (const char *in, size_t in_len, uint8_t *out, size_t out_len)
 
int base58_encode (const uint8_t *in, size_t in_len, char *out, size_t out_len)
 

Variables

uint8_t const BASE58_TABLE []
 
char const BASE58_ALPHABET []
 

Function Documentation

◆ base58_decode()

int base58_decode ( const char *  in,
size_t  in_len,
uint8_t out,
size_t  out_len 
)

Decode input string in base 58.

See also
https://tools.ietf.org/html/draft-msporny-base58-02
Parameters
[in]inPointer to input string buffer.
[in]in_lenLength of the input string buffer.
[out]outPointer to output byte buffer.
[in]out_lenMaximum length to write in output byte buffer.
Returns
number of bytes decoded, -1 otherwise.

Definition at line 45 of file base58.c.

◆ base58_encode()

int base58_encode ( const uint8_t in,
size_t  in_len,
char *  out,
size_t  out_len 
)

Encode input bytes in base 58.

See also
https://tools.ietf.org/html/draft-msporny-base58-02
Parameters
[in]inPointer to input byte buffer.
[in]in_lenLength of the input byte buffer.
[out]outPointer to output string buffer.
[in]out_lenMaximum length to write in output byte buffer.
Returns
number of bytes encoded, -1 otherwise.

Definition at line 108 of file base58.c.

Variable Documentation

◆ BASE58_ALPHABET

char const BASE58_ALPHABET[]
Initial value:
= {
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'
}

Definition at line 38 of file base58.c.

◆ BASE58_TABLE

uint8_t const BASE58_TABLE[]
Initial value:
= {
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0xFF, 0x11, 0x12, 0x13, 0x14, 0x15, 0xFF, 0x16, 0x17, 0x18, 0x19,
0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B,
0xFF, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
}

Definition at line 24 of file base58.c.