Small optimizations.

This commit is contained in:
JoelKatz
2012-11-01 02:49:21 -07:00
parent 824019d8dc
commit f6aaa79bab
4 changed files with 4 additions and 4 deletions

View File

@@ -36,7 +36,7 @@ std::string EncodeBase64(const std::string& s)
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
bmem = BIO_new(BIO_s_mem());
b64 = BIO_push(b64, bmem);
BIO_write(b64, s.c_str(), s.size());
BIO_write(b64, s.data(), s.size());
(void) BIO_flush(b64);
BIO_get_mem_ptr(b64, &bptr);

View File

@@ -19,7 +19,7 @@ uint128 CKey::PassPhraseToKey(const std::string& passPhrase)
{
Serializer s;
s.addRaw(passPhrase.c_str(), passPhrase.size());
s.addRaw(passPhrase);
uint256 hash256 = s.getSHA512Half();
uint128 ret(hash256);

View File

@@ -411,7 +411,7 @@ Json::Value RPCHandler::doAccountEmailSet(const Json::Value &params)
boost::to_lower(strEmail);
std::vector<unsigned char> vucMD5(128/8, 0);
MD5(reinterpret_cast<const unsigned char*>(strEmail.c_str()), strEmail.size(), &vucMD5.front());
MD5(reinterpret_cast<const unsigned char*>(strEmail.data()), strEmail.size(), &vucMD5.front());
uint128 uEmailHash(vucMD5);
std::vector<unsigned char> vucDomain;

View File

@@ -189,7 +189,7 @@ std::string DecodeBase64(std::string s)
b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL);
bmem = BIO_new_mem_buf(const_cast<char*>(s.c_str()), s.size());
bmem = BIO_new_mem_buf(const_cast<char*>(s.data()), s.size());
bmem = BIO_push(b64, bmem);
BIO_read(bmem, buffer, s.size());
BIO_free_all(bmem);