Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
I'm giving OpenID a try and need to get the big endian two's complement of a large (if not) number (a/the default Diffie-Hellman 'p' value) how do I do that in Pike? I've tried to figure it out myself, but I get a bit lost between all the definitions.
This probably does what you want:
string octets = "some binary data"; int|object p = Gmp.bignum(~octets, 256);
That would be one's complement. For two's complement, add one to the result.
Oops, true.
-- Sincerely, Stephen R. van den Berg.