FC Updates from BitShares and myself #21
2 changed files with 3 additions and 8 deletions
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#else
|
|
||||||
# include <alloca.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* stuff common to all ecc implementations */
|
/* stuff common to all ecc implementations */
|
||||||
|
|
@ -231,12 +229,11 @@ namespace fc { namespace ecc {
|
||||||
|
|
||||||
static std::string _to_base58( const extended_key_data& key )
|
static std::string _to_base58( const extended_key_data& key )
|
||||||
{
|
{
|
||||||
size_t buf_len = key.size() + 4;
|
char buffer[key.size() + 4]; // it's a small static array => allocate on stack
|
||||||
char *buffer = (char*)alloca(buf_len);
|
|
||||||
memcpy( buffer, key.data(), key.size() );
|
memcpy( buffer, key.data(), key.size() );
|
||||||
fc::sha256 double_hash = fc::sha256::hash( fc::sha256::hash( (char*) key.data(), key.size() ));
|
fc::sha256 double_hash = fc::sha256::hash( fc::sha256::hash( (char*)key.data(), key.size() ));
|
||||||
memcpy( buffer + key.size(), double_hash.data(), 4 );
|
memcpy( buffer + key.size(), double_hash.data(), 4 );
|
||||||
return fc::to_base58( buffer, buf_len );
|
return fc::to_base58( buffer, sizeof(buffer) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _parse_extended_data( unsigned char* buffer, std::string base58 )
|
static void _parse_extended_data( unsigned char* buffer, std::string base58 )
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
|
|
||||||
#if _WIN32
|
#if _WIN32
|
||||||
# include <malloc.h>
|
# include <malloc.h>
|
||||||
#else
|
|
||||||
# include <alloca.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "_elliptic_impl_priv.hpp"
|
#include "_elliptic_impl_priv.hpp"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue