Commit a99c6e9f authored by lfq's avatar lfq

remove logs

parent 27f7d059
...@@ -14,10 +14,10 @@ void convert_string_2_hex(std::string& input_str, std::string& output_str) ...@@ -14,10 +14,10 @@ void convert_string_2_hex(std::string& input_str, std::string& output_str)
memset(data, 0, input_str.length() + 1); memset(data, 0, input_str.length() + 1);
memcpy ((void *)data, (void *)input_str.c_str(), input_str.length()); memcpy ((void *)data, (void *)input_str.c_str(), input_str.length());
for (int i = 0; i < input_str.length(); i++) { // for (int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]); // printf("%02x ", data[i]);
} // }
printf("\n"); //printf("\n");
char *datahex = (char *) malloc (input_str.length() * 2 + 1); char *datahex = (char *) malloc (input_str.length() * 2 + 1);
memset(datahex, 0, input_str.length() *2 + 1); memset(datahex, 0, input_str.length() *2 + 1);
...@@ -37,9 +37,9 @@ unsigned char * format_string_as_hex(std::string str){ ...@@ -37,9 +37,9 @@ unsigned char * format_string_as_hex(std::string str){
memcpy ((void *)data, (void *)str.c_str(),str_len); memcpy ((void *)data, (void *)str.c_str(),str_len);
std::cout << "Data: " << data << " (" << str_len <<" bytes)" <<std::endl; //std::cout << "Data: " << data << " (" << str_len <<" bytes)" <<std::endl;
std::cout <<"Data (formatted): \n"; //std::cout <<"Data (formatted): \n";
for(int i=0;i<str_len;i++) for(int i=0;i<str_len;i++)
{ {
char datatmp[3] = {0}; char datatmp[3] = {0};
...@@ -57,14 +57,14 @@ unsigned char * format_string_as_hex(std::string str){ ...@@ -57,14 +57,14 @@ unsigned char * format_string_as_hex(std::string str){
// Convert two hexadecimal characters into one character // Convert two hexadecimal characters into one character
unsigned int nAsciiCharacter; unsigned int nAsciiCharacter;
sscanf(datatmp, "%x", &nAsciiCharacter); sscanf(datatmp, "%x", &nAsciiCharacter);
printf("%x ",nAsciiCharacter); //printf("%x ",nAsciiCharacter);
// Concatenate this character onto the output // Concatenate this character onto the output
datavalue[i/2] = (unsigned char)nAsciiCharacter; datavalue[i/2] = (unsigned char)nAsciiCharacter;
// Skip the next character // Skip the next character
i++; i++;
} }
printf("\n"); //printf("\n");
free_wrapper((void**) &data); free_wrapper((void**) &data);
return datavalue; return datavalue;
...@@ -83,12 +83,12 @@ char* bstring2charString(bstring b){ ...@@ -83,12 +83,12 @@ char* bstring2charString(bstring b){
void msg_str_2_msg_hex(std::string msg, bstring &b){ void msg_str_2_msg_hex(std::string msg, bstring &b){
std::string msg_hex_str; std::string msg_hex_str;
convert_string_2_hex(msg, msg_hex_str); convert_string_2_hex(msg, msg_hex_str);
printf("tmp string: %s\n", msg_hex_str.c_str()); //printf("tmp string: %s\n", msg_hex_str.c_str());
unsigned int msg_len = msg_hex_str.length(); unsigned int msg_len = msg_hex_str.length();
char *data = (char *) malloc(msg_len + 1); char *data = (char *) malloc(msg_len + 1);
memset(data, 0, msg_len + 1); memset(data, 0, msg_len + 1);
memcpy ((void *)data, (void *)msg_hex_str.c_str(), msg_len); memcpy ((void *)data, (void *)msg_hex_str.c_str(), msg_len);
printf("data: %s\n", data); //printf("data: %s\n", data);
uint8_t *msg_hex = (uint8_t *) malloc(msg_len/2 + 1); uint8_t *msg_hex = (uint8_t *) malloc(msg_len/2 + 1);
conv::ascii_to_hex (msg_hex, (const char *) data); conv::ascii_to_hex (msg_hex, (const char *) data);
b = blk2bstr(msg_hex, (msg_len/2)); b = blk2bstr(msg_hex, (msg_len/2));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment