cbitcoin
 All Data Structures Files Functions Variables Typedefs
src/structures/CBBase58/CBBase58.h File Reference

Functions for encoding and decoding in base 58. Avoids 0olI whch may look alike. This is for readability concerns. More...

#include <stdlib.h>
#include "CBBigInt.h"
#include "CBDependencies.h"

Go to the source code of this file.

Functions

CBBigInt CBDecodeBase58 (char *str)
 Decodes base 58 string into byte data as a CBBigInt.
CBBigInt CBDecodeBase58Checked (char *str, void(*onErrorReceived)(CBError error, char *,...))
 Decodes base 58 string into byte data as a CBBigInt and checks a 4 byte checksum.
char * CBEncodeBase58 (uint8_t *bytes, uint8_t len)
 Encodes byte data into base 58.

Detailed Description

Functions for encoding and decoding in base 58. Avoids 0olI whch may look alike. This is for readability concerns.


Function Documentation

CBBigInt CBDecodeBase58 ( char *  str)

Decodes base 58 string into byte data as a CBBigInt.

Parameters:
strBase 58 string to decode.
Returns:
Pointer to the byte data as a CBBigInt. The byte data will be created in this function. Remember to free the data. On error the big int will have a NULL data pointer.
CBBigInt CBDecodeBase58Checked ( char *  str,
void(*)(CBError error, char *,...)  onErrorReceived 
)

Decodes base 58 string into byte data as a CBBigInt and checks a 4 byte checksum.

Parameters:
strBase 58 string to decode.
Returns:
Byte data as a CBBigInt. Is zero on failure. Checksum is included in returned data. On error the big int will have a NULL data pointer.
char* CBEncodeBase58 ( uint8_t *  bytes,
uint8_t  len 
)

Encodes byte data into base 58.

Parameters:
bytesPointer to byte data to encode. Will almost certainly be modified. Copy data beforehand if needed.
lenLength of bytes to encode.
Returns:
Newly allocated string with encoded data or NULL on error.