Download the PHP package ionux/phactor without Composer
On this page you can find all versions of the php package ionux/phactor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ionux/phactor
More information about ionux/phactor
Files in ionux/phactor
Package phactor
Short Description Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate & verify private/public (asymmetric) EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.
License MIT
Homepage https://github.com/ionux/phactor
Informations about the package phactor
Description
Phactor is a high-performance PHP implementation of the elliptic curve math functions required to generate private/public EC keypairs and ECDSA signatures based on secp256k1 curve parameters. This library also includes a class to generate Service Identification Numbers (SINs) based on the published Identity Protocol v1 spec.
These PHP classes are designed to be used in conjunction with software used for Bitcoin-related cryptographic operations right now but the ultimate, long-range goal is to become a more general-purpose mathematics library that can also be used for scientific computing and other non-ecc cryptography projects - basically anywhere you need a convenient interface to arbitrary precision math functions implemented in PHP.
Note: These classes require either the BC or GMP math PHP extension (GMP is preferred but will use BC as the fallback). You can read more about the GMP extention here: http://www.php.net/manual/en/book.gmp.php
Installation
Installation of this project is very easy using composer:
If you have git installed, you can clone the repository:
Or you can install manually by downloading a zip file from the Releases page and extracting the contents into your project's source directory.
Note: Phactor is under active development so you should always download the project from the Releases page. Those packages are the only packages you should rely upon in a production environment since the bleeding edge source changes could contain regressions.
Usage
Integrating these classes with your project is very simple. For example, after including the necessary Phactor class files (or using an autoloader), to generate keypairs:
An associative array will be returned upon success:
Depending on the speed of your hardware, keys can be generated in approximately 10ms or less using GMP.
To generate ECDSA signatures:
Which will return the signature encoded in the ASN.1 DER format:
To verify an existing signature, call the Verify() function which returns a boolean true/false:
Signatures and keys have been tested against OpenSSL and are interoperable. In fact, any other project that can import/export correct EC keypairs and ECDSA signatures will be compatible with this library.
Note: All points and signatures are verified to be mathematically correct before they're returned to the caller. An \Exception is thrown if a point or signature does not pass the verification methods.
The class to generate Service Identification Numbers (SINs) works in a similar fashion. Pass the compressed public key in hex form, for example:
Which will return a single, BASE-58 encoded value beginning with the letter 'T' (specific value to SINs). For example:
Note: When using this class to generate SINs for use in a Bitcoin-related project, the usage of uncompressed public keys is deprecated. Use only the compressed public key when generating a SIN for this purpose to remain compatible with the Bitcoin network.
Found a bug?
Let me know! Send a pull request or a patch. Questions? Ask! I will respond to all filed issues.
Support:
- GitHub Issues
- Open an issue if you are having issues with this library
Contribute
Would you like to help with this project? Great! You don't have to be a developer, either. If you've found a bug or have an idea for an improvement, please open an issue and tell me about it.
If you are a developer wanting contribute an enhancement, bugfix or other patch to this project, please fork this repository and submit a pull request detailing your changes. I review all PRs!
This open source project is released under the MIT license which means if you would like to use this project's code in your own project you are free to do so. Speaking of, if you have used Phactor in a cool new project I would like to hear about it!
License
All versions of phactor with dependencies
ext-bcmath Version *
ext-openssl Version *