Skip to content

🔏️ PHP routines for verifying Cryptocurrency signatures with GMP or BC Math (yes, BC is slow)

License

Notifications You must be signed in to change notification settings

RealityRipple/php-bitcoin-signature-routines

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

php-bitcoin-signature-routines

PHP routines for verifying Cryptocurrency signatures. Requires PHP 5.3.2 with either GMP or BC Math.

At present, Bitcoin, Bitcoin Gold, Litecoin, Dogecoin, Dash, DigiByte, Ripple, and Zcash Base58 addresses are supported. Other addresses of the same format can be added through the addrInfo function fairly easily.

The isMessageSignatureValid function now returns a string with results rather than throwing errors. Possible results are:

  • Valid The Address matches the Message and Signature.
  • Invalid The Address does not match the Message and Signature.
  • Invalid Coin The Coin is not supported. Valid Coin values are: BTC, BCH, BTG, DOGE, DASH, DGB, LTC, XRP, or ZEC.
  • Invalid Address Length The Decoded Address is not 20 bytes + Version Length (1 for most, 2 for Zcash).
  • Invalid Address Checksum The last four bytes of the Decoded Address are not equal to the first four bytes of a double-sha256 hash of the Decoded Address.
  • Invalid Address The Address Version is not supported.
  • Invalid Signature The Signature could not be Base64 decoded.
  • Invalid Signature Length The Decoded Signature was not 65 bytes long.
  • Invalid Signature Flags The Signature's Recovery Flags were either negative or greater than 7.
  • Invalid Public Key The attempt to determine the Public Key from the Message and Signature failed.

About

🔏️ PHP routines for verifying Cryptocurrency signatures with GMP or BC Math (yes, BC is slow)

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • PHP 100.0%