lib/BlockCypher/Crypto/Signer.php
public static function sign($hexDataToSign, $privateKey)
    {
        if (is_string($privateKey)) {
            $privateKey = PrivateKeyManipulator::importPrivateKey($privateKey);
        }

        // Convert hex data to buffer
        $data = Buffer::hex($hexDataToSign);

        /** @var EcAdapterInterface $ecAdapter */
        $ecAdapter = Bitcoin::getEcAdapter();

        // Deterministic digital signature generation
        $k = new Rfc6979($ecAdapter, $privateKey, $data, 'sha256');

        $sig = $ecAdapter->sign($data, $privateKey, $k);

        // DEBUG
        //echo "hexDataToSign: <br/>";
        //var_dump($hexDataToSign);
        //echo "sig: <br/>";
        //var_dump($sig->getHex());

        return $sig->getHex();
    }
public static function sign($hexDataToSign, $privateKey)
    {
        if (is_string($privateKey)) {
            $privateKey = PrivateKeyManipulator::importPrivateKey($privateKey);
        }

        // Convert hex data to buffer
        $data = Buffer::hex($hexDataToSign);

        /** @var EcAdapterInterface $ecAdapter */
        $ecAdapter = Bitcoin::getEcAdapter();

        // Deterministic digital signature generation
        $k = new Rfc6979($ecAdapter, $privateKey, $data, 'sha256');

        $sig = $ecAdapter->sign($data, $privateKey, $k);

        // DEBUG
        //echo "hexDataToSign: <br/>";
        //var_dump($hexDataToSign);
        //echo "sig: <br/>";
        //var_dump($sig->getHex());

        return $sig->getHex();
    }
public static function sign ( $ hexDataToSign , $ privateKey ) { if ( is_string ( $ privateKey ) ) { $ privateKey = PrivateKeyManipulator :: importPrivateKey ( $ privateKey ) ; } // Convert hex data to buffer $ data = Buffer :: hex ( $ hexDataToSign ) ; /** @var EcAdapterInterface $ecAdapter */ $ ecAdapter = Bitcoin :: getEcAdapter ( ) ; // Deterministic digital signature generation $ k = new Rfc6979 ( $ ecAdapter , $ privateKey , $ data , 'sha256' ) ; $ sig = $ ecAdapter -> sign ( $ data , $ privateKey , $ k ) ; // DEBUG //echo "hexDataToSign: <br/>"; //var_dump($hexDataToSign); //echo "sig: <br/>"; //var_dump($sig->getHex()); return $ sig -> getHex ( ) ; }
Sign hex data deterministically using deterministic k.

@param string $hexDataToSign
@param PrivateKeyInterface|string $privateKey
@return string
Sign hex data deterministically using deterministic k .