adjustment to use other sha256 code

This commit is contained in:
John Jones 2016-11-15 21:19:18 -05:00
parent 93dc4d558f
commit 9b55d84d95

View file

@ -5,6 +5,7 @@
#include "string.h" #include "string.h"
#include <stdio.h> #include <stdio.h>
#include "libp2p/crypto/encoding/base58.h" #include "libp2p/crypto/encoding/base58.h"
#include "libp2p/crypto/hashing/sha256.h"
#include "mh/multihash.h" #include "mh/multihash.h"
#include "mh/hashes.h" #include "mh/hashes.h"
@ -193,11 +194,7 @@ int PrettyID(unsigned char * pointyaddr, size_t* rezbuflen,unsigned char * ID_BU
// base58 the multihash // base58 the multihash
returnstatus = libp2p_crypto_encoding_base58_encode(temp_buffer, strlen(temp_buffer), &pointyaddr, rezbuflen); returnstatus = libp2p_crypto_encoding_base58_encode(temp_buffer, strlen(temp_buffer), &pointyaddr, rezbuflen);
if(returnstatus == 0) if(returnstatus == 0)
{
printf("\nERROR!!!!!\n");
return 0; return 0;
}
return 1; return 1;
} }
@ -210,6 +207,7 @@ int PrettyID(unsigned char * pointyaddr, size_t* rezbuflen,unsigned char * ID_BU
*/ */
void ID_FromPK_non_null_terminated(char * result,unsigned char * texttohash, size_t text_size) void ID_FromPK_non_null_terminated(char * result,unsigned char * texttohash, size_t text_size)
{ {
/* old way
unsigned char hash[32]; unsigned char hash[32];
bzero(hash,32); bzero(hash,32);
SHA256_CTX ctx; SHA256_CTX ctx;
@ -217,6 +215,8 @@ void ID_FromPK_non_null_terminated(char * result,unsigned char * texttohash, siz
sha256_update(&ctx,texttohash,text_size); sha256_update(&ctx,texttohash,text_size);
sha256_final(&ctx,hash); sha256_final(&ctx,hash);
a_store_hash(result,hash); a_store_hash(result,hash);
*/
libp2p_crypto_hashing_sha256(texttohash, text_size, result);
} }
/**** /****