Creating mpz_t from binary data

Saju Pillai saju.pillai at
Wed Mar 17 16:22:06 CET 2010


  I am new to GMP. I receive a multi precision big endian integer 
represented in two's complement. I am on a little endian machine. How 
can I create a mpz_t using this data ?

Will reversing the data bytes to create a little endian representation 
and calling mpz_set_str(rop, data, 2) work ?. Since this is binary data, 
  NULs may occur anywhere in the data. How do you suggest I proceed ?

The mpint data type described at (SSH architecture rfc) is 
the data format I am dealing with.


More information about the gmp-discuss mailing list