Creating mpz_t from binary data
saju.pillai at gmail.com
Wed Mar 17 16:47:43 CET 2010
Marc Glisse wrote:
> On Wed, 17 Mar 2010, Saju Pillai wrote:
>> 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
>> http://tools.ietf.org/html/rfc4251#section-5 (SSH architecture rfc) is
>> the data format I am dealing with.
> did you try http://gmplib.org/manual/Integer-Import-and-Export.html ?
Yes, this is what I am looking for. I happened to find mpz_import() just
after sending out the query. Thanks for replying though.
More information about the gmp-discuss