uchar *ClaveVariable::ToRaw (uint &size) const
{
- uchar *out;
- size = raw_data.size ()*sizeof (uchar)+sizeof (uint);
- uint len = raw_data.size ();
- out = new uchar[size];
- memcpy (out, &len, sizeof (uint));
- memcpy (out+sizeof(uint), raw_data.c_str (), raw_data.size ()*sizeof (uchar));
+ std::stringstream ss;
+
+ ss << "[";
+ ss << data.size ();
+ ss << "]";
+ ss << "[";
+ ss << raw_data;
+ ss << "]";
+ ss << "[";
+ ss << block_data;
+ ss << "]";
+
+ std::string s = ss.str ();
+
+ uchar *out = new uchar[s.size ()];
+ memcpy (out, s.c_str (), s.size ());
+
+ size = s.size ();
return out;
}