Fixed base32 encoding

This commit is contained in:
John Jones 2016-11-28 16:12:11 -05:00
parent 927933a20f
commit a2daf88b26
4 changed files with 6 additions and 8 deletions

View file

@ -2,9 +2,7 @@
DEBUG = true
export DEBUG
OBJS = crypto/rsa.o crypto/sha256.o crypto/encoding/base58.o crypto/encoding/base64.o \
crypto/encoding/x509.o thirdparty/mbedtls/*.o crypto/encoding/base16.o \
hashmap/hashmap.o
OBJS = crypto/*.o crypto/encoding/*.o thirdparty/mbedtls/*.o hashmap/hashmap.o
compile:

View file

@ -2,8 +2,9 @@ CC = gcc
CFLAGS = -O0 -I../../include -g3
LFLAGS =
DEPS = ../../include/libp2p/crypto/encoding/base58.h ../../include/libp2p/crypto/encoding/base64.h \
../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h
OBJS = base58.o base64.o x509.o base16.o
../../include/libp2p/crypto/encoding/x509.h ../../include/libp2p/crypto/encoding/base16.h \
../../include/libp2p/crypto/encoding/base32.h
OBJS = base58.o base64.o x509.o base16.o base32.o
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)

View file

@ -37,8 +37,6 @@
*
*/
#include <config.h>
/* Get prototype. */
/* Get size_t. */
# include <stddef.h>
@ -639,7 +637,7 @@ base32_decode_alloc_ctx (struct base32_decode_context *ctx,
int libp2p_crypto_encoding_base32_encode(const unsigned char* incoming, size_t incoming_length,
unsigned char* results, size_t* results_length) {
base32_encode(incoming, incoming_length, results, *results_length);
results_length = strlen(results);
*results_length = strlen(results);
return 1;
}

View file

@ -1,6 +1,7 @@
#ifndef __LIBP2P_CRYPTO_ENCODING_BASE32_H__
#define __LIBP2P_CRYPTO_ENCODING_BASE32_H__
#include <string.h>
/**
* Encode in Base32 format