update apis

This commit is contained in:
Daniel Larimer 2014-03-27 01:09:08 -04:00
parent bdeefb48bf
commit 987568e31b
4 changed files with 20 additions and 2 deletions

View file

@ -99,7 +99,7 @@ namespace fc {
*/
fc::sha512 get_shared_secret( const public_key& pub )const;
signature sign( const fc::sha256& digest );
signature sign( const fc::sha256& digest )const;
compact_signature sign_compact( const fc::sha256& digest )const;
bool verify( const fc::sha256& digest, const signature& sig );

View file

@ -21,6 +21,8 @@ namespace fc
class variant_object;
fc::string format_string( const fc::string&, const variant_object& );
fc::string trim( const fc::string& );
fc::string to_lower( const fc::string& );
string trim_and_normalize_spaces( const string& s );
}
#else

View file

@ -357,7 +357,7 @@ namespace fc { namespace ecc {
return self;
}
signature private_key::sign( const fc::sha256& digest )
signature private_key::sign( const fc::sha256& digest )const
{
unsigned int buf_len = ECDSA_size(my->_key);
// fprintf( stderr, "%d %d\n", buf_len, sizeof(sha256) );

View file

@ -104,9 +104,25 @@ namespace fc {
}
std::string trim( const std::string& s )
{
return boost::algorithm::trim_copy(s);
/*
std::string cpy(s);
boost::algorithm::trim(cpy);
return cpy;
*/
}
std::string to_lower( const std::string& s )
{
auto tmp = s;
boost::algorithm::to_lower(tmp);
return tmp;
}
string trim_and_normalize_spaces( const string& s )
{
string result = boost::algorithm::trim_copy( s );
while( result.find( " " ) != result.npos )
boost::algorithm::replace_all( result, " ", " " );
return result;
}
} // namespace fc