serialization de Integer (cryptopp) in ns3
std::ostringstream oss;
oss << m_n;
std::string s = oss.str();
//std::cout << s << std::endl;
// serialisation
int x;
int len=s.length();
uint8_t l= (uint8_t) len;
// std::cout <<"h serialize"<< h<< std::endl;
// cout<< "len serialz "<<len<<" \n"<<endl;
i.WriteU8 (l); //insérer la longueur de la chaine pour l'utiliser dans
la déserialisation
for (int j = 0; j < len; j++)
{
x= (int) s[j];
uint8_t y = (uint8_t) x;
i.WriteU8 (y);
}
unserialization of Integer (cryptopp) in ns3
uint8_t l = i.ReadU8 (); //récupérer la longueur
double gg= (double) l;
int len = ( int ) gg;
//cout<< "len deserialz "<<len<<" \n"<<endl;
len=310;
// cout<< "len serialz "<<len<<" \n"<<endl;
std::istringstream iss;
string s="";
//construction du string
for (int j = 0; j < len; j++)
{
uint8_t ci = i.ReadU8();
int cii = (int) ci;
char c = char(cii);
//cout<< "le caractère est :cc "<<c<<" \n"<<endl;
s+=c; //concaténer caractère par caractère pour récupérer toute la chaine
}
const char* cstr = s.c_str() ;
//j'ai utiliser ce constructeur pour récupérer le Integer, Integer(const
char *str)
Integer g = Integer(cstr);
m_n=g;
I found the solution I want to share it with you for
Le dim. 26 mai 2019 à 02:34, Ahlem <[email protected]> a écrit :
> i use this unserialize
> char c;
> Integer m_n;
> m_n=Integer(c);
> it's correct please help
>
> --
> You received this message because you are subscribed to "Crypto++ Users".
> More information about Crypto++ and this group is available at
> http://www.cryptopp.com and
> http://groups.google.com/forum/#!forum/cryptopp-users.
> ---
> You received this message because you are subscribed to the Google Groups
> "Crypto++ Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cryptopp-users/5070ad53-ec27-42b5-8198-6c9c296d9c1d%40googlegroups.com
> <https://groups.google.com/d/msgid/cryptopp-users/5070ad53-ec27-42b5-8198-6c9c296d9c1d%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to "Crypto++ Users". More
information about Crypto++ and this group is available at
http://www.cryptopp.com and
http://groups.google.com/forum/#!forum/cryptopp-users.
---
You received this message because you are subscribed to the Google Groups
"Crypto++ Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/cryptopp-users/CANpKRw4GRBRBb9SsTQWsW6H1%2BYx9sOPZ16QTo81wXCDJ4U5-TQ%40mail.gmail.com.