revert to std types

This commit is contained in:
Daniel Larimer 2012-09-10 23:57:11 -04:00
parent ac7ca49af5
commit e4fbbe52b0
4 changed files with 20 additions and 19 deletions

View file

@ -1,10 +1,10 @@
#ifndef _FC_BASE64_HPP
#define _FC_BASE64_HPP
#include <fc/string.hpp>
#include <string>
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

View file

@ -1,6 +1,7 @@
#ifndef _FC_DH_HPP_
#define _FC_DH_HPP_
#include <fc/vector.hpp>
//#include <fc/vector.hpp>
#include <vector>
#include <stdint.h>
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<char>& pubk);
bool compute_shared_key( const std::vector<char>& pubk);
bool validate();
fc::vector<char> p;
fc::vector<char> pub_key;
fc::vector<char> priv_key;
fc::vector<char> shared_key;
std::vector<char> p;
std::vector<char> pub_key;
std::vector<char> priv_key;
std::vector<char> shared_key;
bool valid;
uint8_t g;
};

View file

@ -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_++;

View file

@ -84,7 +84,7 @@ namespace fc {
DH_free(dh);
return valid = true;
}
bool diffie_hellman::compute_shared_key( const fc::vector<char>& pubk ) {
bool diffie_hellman::compute_shared_key( const std::vector<char>& pubk ) {
return compute_shared_key( &pubk.front(), pubk.size() );
}