Separate an mpz_t into least and most significant bits.

Alexandre Imperatori info at alexandreimperatori.com
Sun Dec 19 14:56:11 CET 2010


Hello,

I am rather new to GMP and am working on some cryptographic functions.

I have an mpz_t variable holding a number which we can call z and is n bits long.

What I need to do is to derive two mpz_t variables zL (z low) and zH (z high) . Each is n/2 bits long and zL should contain the n/2 least significant bits of z while zH should contain the n/2 most significant bits of z.

There must be some easy way to do that efficiently but I can't pinpoint it correctly.

If anyone could help would be great!

Thanks in advance,


Alexandre Imperatori


More information about the gmp-discuss mailing list