diff --git a/include/fc/base64.hpp b/include/fc/base64.hpp index 75778e7..3a69a2e 100644 --- a/include/fc/base64.hpp +++ b/include/fc/base64.hpp @@ -1,10 +1,10 @@ #ifndef _FC_BASE64_HPP #define _FC_BASE64_HPP -#include +#include namespace fc { -fc::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); -fc::string base64_encode( const fc::string& enc ); -fc::string base64_decode( const fc::string& encoded_string); +std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); +std::string base64_encode( const std::string& enc ); +std::string base64_decode( const std::string& encoded_string); } // namespace fc #endif // _FC_BASE64_HPP diff --git a/include/fc/dh.hpp b/include/fc/dh.hpp index 3005896..ec9112f 100644 --- a/include/fc/dh.hpp +++ b/include/fc/dh.hpp @@ -1,6 +1,7 @@ #ifndef _FC_DH_HPP_ #define _FC_DH_HPP_ -#include +//#include +#include #include namespace fc { @@ -10,13 +11,13 @@ namespace fc { bool generate_params( int s, uint8_t g ); bool generate_pub_key(); bool compute_shared_key( const char* buf, uint32_t s ); - bool compute_shared_key( const fc::vector& pubk); + bool compute_shared_key( const std::vector& pubk); bool validate(); - fc::vector p; - fc::vector pub_key; - fc::vector priv_key; - fc::vector shared_key; + std::vector p; + std::vector pub_key; + std::vector priv_key; + std::vector shared_key; bool valid; uint8_t g; }; diff --git a/src/base64.cpp b/src/base64.cpp index 15f4711..05e25e1 100644 --- a/src/base64.cpp +++ b/src/base64.cpp @@ -29,9 +29,9 @@ namespace fc { -inline const fc::string& base64_chars() +inline const std::string& base64_chars() { - static const fc::string m_base64_chars = + static const std::string m_base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/"; @@ -42,15 +42,15 @@ static inline bool is_base64(unsigned char c) { return (isalnum(c) || (c == '+') || (c == '/')); } -fc::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); +std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); -fc::string base64_encode( const fc::string& enc ) { +std::string base64_encode( const std::string& enc ) { char const* s = enc.c_str(); return base64_encode( (unsigned char const*)s, enc.size() ); } -fc::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { +std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) { - fc::string ret; + std::string ret; int i = 0; int j = 0; unsigned char char_array_3[3]; @@ -93,13 +93,13 @@ fc::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_l } -fc::string base64_decode(fc::string const& encoded_string) { +std::string base64_decode(std::string const& encoded_string) { int in_len = encoded_string.size(); int i = 0; int j = 0; int in_ = 0; unsigned char char_array_4[4], char_array_3[3]; - fc::string ret; + std::string ret; while (in_len-- && ( encoded_string[in_] != '=') && is_base64(encoded_string[in_])) { char_array_4[i++] = encoded_string[in_]; in_++; diff --git a/src/dh.cpp b/src/dh.cpp index 345e632..642deb2 100644 --- a/src/dh.cpp +++ b/src/dh.cpp @@ -84,7 +84,7 @@ namespace fc { DH_free(dh); return valid = true; } - bool diffie_hellman::compute_shared_key( const fc::vector& pubk ) { + bool diffie_hellman::compute_shared_key( const std::vector& pubk ) { return compute_shared_key( &pubk.front(), pubk.size() ); }