Re: [RFC] OpenSSL BigNum support

From: Date: Wed, 19 Oct 2016 00:20:53 +0000
Subject: Re: [RFC] OpenSSL BigNum support
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-96454@lists.php.net to get a copy of this message
And sorry for the spam (this should have been mentioned in the last email), as far as I can tell, there is no-way to say "I want a either a signed or unsigned integer with an N bits", I've come across this recently whilst trying to implement Murmur3 (128-bit) in PHP, I can of-course binary AND into 0b111111111111111111111111111111111111111111111111111111111111111 (e.g. $x & 0b11...) and it will yield result of 9,223,372,036,854,775,807 ((2^63)- 1 (PHP_INT_MAX)) but adding an additional 1 (radix 10) will yield a double(9.2233720368548E+18) and it's at that point it becomes incredibly difficult to work with to work with natural numbers. (Unrelated to Sara's RFC, just a thought I'd mention incase someone is interested...) I personally think this RFC is fine despite the existing libraries that do similar (BCMath and GMP), it's more of an interface to the lower layer (and OpenSSL specific) rather than an implementation. We're just keeping up with existing implementations. Sara, I'm happy to implement additional tests and look at fast ZPP for methods tomorrow if you're too busy and think this is going somewhere... DM

« previous php.internals (#96454) next »