2019-09-08, 06:11 PM
I've decided that I would get into writing modules for PHP for a brief moment.
So far I've added two modules to PHP 7.3.9 (and I'm not sure if these already exist but anywho...)
Here's my favorite of the two modules: PCG-64 in PHP
Here's my other module: Base32 in PHP
Let me know if you want me to continue down this road or if you have anything you want to see converted into a PHP module. I don't know if the staff on this forum will allow me to take requests like this, but if they do then I'd like for all requests to follow an organized structure:
Just bear in mind that this is just an offer from me to get some experience with writing modules for PHP, don't expect me to produce something quickly unless it's a small module. I'll retain the right to upload the module to my GitHub page and that's where I'll link you so that you can download the sources to compile for yourself since I only have access to a Linux machine at the moment.
So far I've added two modules to PHP 7.3.9 (and I'm not sure if these already exist but anywho...)
Here's my favorite of the two modules: PCG-64 in PHP
Quote:PCG (Permutable Congruence Generator) is a PRNG method that was written by Melissa O'Neill and it is supposedly a more robust and lightweight PRNG method when compared to the competition (including Mersenne Twister).
I decided to take the 64-bit implementation (making this a module that solely functions with 64-bit versions of PHP) and I changed the seeding method from the standard system timestamp to the value that is returned by the RDTSC assembly instruction.
This means that the extension will only function on CPUs that support either the x86_64 or the AMD64 instruction set. I can't guarantee the robustness of this method when compared to the timestamp method in the original sources, but I know it will return a different value every time.
Here's my other module: Base32 in PHP
Quote:The Base32 encoding method is one of those encoding methods that we don't tend to find useful unless it's in the case of generating 2FA tokens (that's very important).
I did make a PHP-only variant of this and I'm going to implement that into a future plugin, but I also wanted a module that would outperform a PHP-only variant of Base32 encoding/decoding.
Maybe the PHP 8 JIT will push PHP into speeds closer to C, but I don't have too high of hopes of that becoming a reality based on the previous track record for Zend (not to hate on Zend or anything, but I've lost a lot of faith in them over the years).
Let me know if you want me to continue down this road or if you have anything you want to see converted into a PHP module. I don't know if the staff on this forum will allow me to take requests like this, but if they do then I'd like for all requests to follow an organized structure:
Module Name
Target PHP Version
function_name_1(type arg1, type arg2, type arg3, ...) : return_type;
function_name_2(type arg1, type arg2, type arg3, ...) : return_type;
function_name_3(type arg1, type arg2, type arg3, ...) : return_type;
Just bear in mind that this is just an offer from me to get some experience with writing modules for PHP, don't expect me to produce something quickly unless it's a small module. I'll retain the right to upload the module to my GitHub page and that's where I'll link you so that you can download the sources to compile for yourself since I only have access to a Linux machine at the moment.