Generates a random number //
// plurality of public, private key, by the client to negotiate to determine which
// After generating a random number, encrypts it with the private key to generate a ciphertext
// reuse base64 encoding adhesion convert text into a string
// the last placed into the payload format can be json returned to the client
// handshake negotiation, will generate a random string using two ostringstream
// MD5 coding, the output format in hexadecimal numbers
// will conversion number is a string of hexadecimal format
// use symmetric encryption to xxtea interaction data
string GetRandStr ()
{
// 8 generates a random number two digit
struct timeval now;
the gettimeofday (& now, NULL);
srand(now.tv_usec);
unsigned int rand1 = (unsigned int)rand();
srand(now.tv_usec + 1);
unsigned int rand2 = (unsigned int)rand();
char buff[17];
sprintf(buff,"%08x%08x",rand1,rand2);
string strRand ;
strRand.insert(0,buff,16);
return strRand ;
}