PHP bls12-381 private.to_public, sign, verify functions

Job ID: 34432193

Budget: $30 – $250 USD

I want a native PHP bls12_381 implementation that can:
1) given a 32 byte hex-encoded secret key, calculate the 48-byte hex-encoded public key.
example: given secret key = 3fa910fb94b0566f6f29c9c5bf000e89e2be8e768ee4b87e5845dc944302ece9
return public key = a27e212297418cc7036c389161781022929ecf0bfa461eef5b9f73822f40e8a941c76e7959bc67c39427583fefee6776

2) given a 32 byte hex-encoded secret key and a hex-encoded message, calculate the BLS12-381 signature
example: given secret key = 3fa910fb94b0566f6f29c9c5bf000e89e2be8e768ee4b87e5845dc944302ece9
given hex-encoded message = 6787842d771cddfd91b0bed61eaf6fb635594e8a364a01c9160d054e4bb301dc
return signature = 84c854c2011d90af6ba717e0e152808ca1734637b2526a282ee5a282ab68bb9f05cb5c72c882403b51d9cc8ea3fd84df17666072c06ee92d057652083a0517531cb26f22438da093481a1b6b8b299eac1a101b3f4150a714f3c16620c98f8330

3) given a hex-encoded public key, signature, and message, return true or false = whether or not the signature is valid for that public key and message
example: given: public key = a27e212297418cc7036c389161781022929ecf0bfa461eef5b9f73822f40e8a941c76e7959bc67c39427583fefee6776
given: signature = 84c854c2011d90af6ba717e0e152808ca1734637b2526a282ee5a282ab68bb9f05cb5c72c882403b51d9cc8ea3fd84df17666072c06ee92d057652083a0517531cb26f22438da093481a1b6b8b299eac1a101b3f4150a714f3c16620c98f8330
given: message = 6787842d771cddfd91b0bed61eaf6fb635594e8a364a01c9160d054e4bb301dc
return true

You may use https://github.com/simplito/elliptic-php as a base if it makes it easier; if not, a standalone project works too.

I've attached a Python example of the private.to_public and sign functions, which can be used as follows:
private-to-public (outputs hex-encoded public key): python bls.py {hex-encoded-secret-key}
sign (outputs hex-encoded signature): python bls.py {hex-encoded-secret-key} {hex-encoded-message}
Related categories: PHP Software Architecture Cryptography