Added sha512 encoding

This commit is contained in:
John Jones 2017-01-23 11:31:24 -05:00
parent 7e7a4e0712
commit d3cfece252
3 changed files with 25 additions and 1 deletions

View file

@ -2,7 +2,7 @@ CC = gcc
CFLAGS = -O0 -I../include -g3 CFLAGS = -O0 -I../include -g3
LFLAGS = LFLAGS =
DEPS = DEPS =
OBJS = rsa.o sha256.o OBJS = rsa.o sha256.o sha512.o
%.o: %.c $(DEPS) %.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS) $(CC) -c -o $@ $< $(CFLAGS)

13
crypto/sha512.c Normal file
View file

@ -0,0 +1,13 @@
#include "mbedtls/sha512.h"
/***
* hash a string using SHA512
* @param input the input string
* @param input_length the length of the input string
* @param output where to place the results
* @returns 1
*/
int libp2p_crypto_hashing_sha512(const unsigned char* input, size_t input_length, unsigned char output[128]) {
mbedtls_sha512(input, input_length, output, 0);
return 1;
}

View file

@ -0,0 +1,11 @@
#pragma once
/***
* hash a string using SHA512
* @param input the input string
* @param input_length the length of the input string
* @param output where to place the results
* @returns 1
*/
int libp2p_crypto_hashing_sha512(const unsigned char* input, size_t input_length, unsigned char output[128]);