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.
Thanks in advance!
Coen
__________________________________________________________ Deze e-mail en de inhoud is vertrouwelijk en uitsluitend bestemd voor de geadresseerde(n). Indien u niet de geadresseerde bent van deze e-mail verzoeken wij u dit direct door te geven aan de verzender door middel van een reply e-mail en de ontvangen e-mail uit uw systemen te verwijderen. Als u geen geadresseerde bent, is het niet toegestaan om kennis te nemen van de inhoud, deze te kopieren, te verspreiden, bekend te maken aan derden noch anderszins te gebruiken.
The information contained in this e-mail is confidential and may be legally privileged. It is intended solely for the addressee. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. Please notify us immediately if you have received it in error by reply e-mail and then delete this message from your system. __________________________________________________________
On Thu, Apr 16, 2009 at 09:41:50AM +0200, Coen Schalkwijk 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.
how would you do that in another language?
greetings, martin.
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);
Thanks in advance!
Coen
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.
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.
pike-devel@lists.lysator.liu.se