Sign current datas
@param string $data
@param string $secret
@return string
543347
public function sign(string $data, string $secret): string {
        return base64_encode(hash_hmac('md5', $data, $secret, true));
    }
1062060
protected static function _signature($data, $secret = null) {
		unset($data['__signature']);
		$secret = ($secret) ?: static::$_secret;
		return hash_hmac('sha1', serialize($data), $secret);
	}
199083
public function verifySignature($data, $signature)
    {
        switch ($this->cryptParams['library']) {
            case 'openssl':
                return $this->verifyOpenSSL($data, $signature);
            case (self::HMAC_SHA1):
                $expectedSignature = hash_hmac("sha1", $data, $this->key, true);
                return strcmp($signature, $expectedSignature) == 0;
        }
    }
1141646
public static function decode($input, $secret = null) {
        // no input?
        if(!$input)
            return false;

        // decode
        $decoded = self::base64decode($input);
        if(!$decoded)
            return false;

        // output
        return self::xor($decoded, self::secret($secret));
    }
649283
private static function sign($data, string $secret, string $algo='sha256')
  {
    return hash_hmac($algo, $data, $secret, false);
  }
1244492
private function signOpenSSL($data)
    {
        $algo = OPENSSL_ALGO_SHA1;
        if (!empty($this->cryptParams['digest'])) {
            $algo = $this->cryptParams['digest'];
        }
        if (!openssl_sign($data, $signature, $this->key, $algo)) {
            throw new Exception('Failure Signing Data: ' . openssl_error_string() . ' - ' . $algo);
        }
        return $signature;
    }
398922
public function getSignature($secret = null)
    {
        $signature = '';

        if($this->_algorithm)
        {
            $header  = $this->_toBase64url($this->_toJson($this->_header));
            $payload = $this->_toBase64url($this->_toJson($this->_claims));

            $message   = sprintf("%s.%s", $header, $payload);
            $signature = hash_hmac($this->_algorithm, $message, $secret, true);
        }

        return $signature;
    }
88116
public function signData($data)
    {
        switch ($this->cryptParams['library']) {
            case 'openssl':
                return $this->signOpenSSL($data);
            case (self::HMAC_SHA1):
                return hash_hmac("sha1", $data, $this->key, true);
        }
    }
807166
public function generateWebhookSignature(
        string $url,
        \stdClass $data,
        string $secret_key
    ) {
        $signature = $url;
        $signature .= json_encode($data);

        return base64_encode(hash_hmac('sha1', $signature, $secret_key, true));
    }
1100299
public static function validate($payload, $secret, $signature)
    {
        return hash_equals(self::compute($payload, $secret), $signature);
    }
1310873
public function verifySign($data, $key)
    {
        $prestr = $data['prestr'];
        $sign = $data['sign'];
        $prestr = $prestr . $key;
        $mysgin = md5($prestr);

        if($mysgin == $sign) {
            return true;
        }

        return false;
    }
218239
def sign(data)
      sig = @key.dsa_sign_asn1(data)
      if Script::is_low_der_signature?(sig)
        sig
      else
        Bitcoin::OpenSSL_EC.signature_to_low_s(sig)
      end
    end
127035
public function sendData($data)
    {
        $signer = new Signer($data);
        $signer->setIgnores(array('signature'));
        $content   = $signer->getContentToSign();
        $publicKey = $this->getPublicKey();

        if (! $this->getPublicKey()) {
            $publicKey = Signer::findPublicKey($data['certId'], $this->getCertDir());
        }

        $data['verify_success'] = $signer->verifyWithRSA($content, $data['signature'], $publicKey);

        $data['is_paid'] = $data['verify_success'] && ($this->getRequestParam('respCode') == '00');

        return $this->response = new ExpressCompletePurchaseResponse($this, $data);
    }
1241570
def sign(self, data):
        
        if self.signing_key is None:
            raise MissingSigningKeyError("KeyPair does not contain secret key. "
                                         "Use Keypair.from_seed method to create a new keypair with a secret key.")
        return self.signing_key.sign(data)
935148
public function signXML($data)
    {
        $xml = new DOMDocument;
        $xml->preserveWhiteSpace = false;
        $xml->loadXML($data);

        $sig = new DOMDocument;
        $sig->preserveWhiteSpace = false;
        $sig->loadXML(
            '<Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
                <SignedInfo>
                    <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
                    <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
                    <Reference URI="">
                        <Transforms>
                            <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
                        </Transforms>
                        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
                        <DigestValue/>
                    </Reference>
                </SignedInfo>
                <SignatureValue/>
                <KeyInfo><KeyName/></KeyInfo>
            </Signature>'
        );

        $sig = $xml->importNode($sig->documentElement, true);
        $xml->documentElement->appendChild($sig);

        // calculate digest
        $xpath = $this->getXPath($xml);
        $digestValue = $xpath->query('ds:Signature/ds:SignedInfo/ds:Reference/ds:DigestValue')->item(0);
        $digestValue->nodeValue = $this->generateDigest($xml);

        // calculate signature
        $signedInfo = $xpath->query('ds:Signature/ds:SignedInfo')->item(0);
        $signatureValue = $xpath->query('ds:Signature/ds:SignatureValue')->item(0);
        $signatureValue->nodeValue = $this->generateSignature($signedInfo);

        // add key reference
        $keyName = $xpath->query('ds:Signature/ds:KeyInfo/ds:KeyName')->item(0);
        $keyName->nodeValue = $this->getPublicKeyDigest();

        return $xml->saveXML();
    }
388065
protected function createSignature($data, $secret)
    {
        return base64_encode(hash_hmac('sha512', http_build_query($data, '', '&'), base64_decode($secret), true));
    }
72153
public function createSign($data)
	{
		$data = $data . self::getSecretKey() . self::getPrivateKey();
		return md5($data);
	}