Get the base64-encoded signature itself.
        Can only be called once.
504103
def finalize(self):
        
        signature = self.signer.finalize()
        sig_r, sig_s = decode_dss_signature(signature)
        sig_b64 = encode_signature(sig_r, sig_s)
        return sig_b64
393182
function (input, signature, b64safeKey, alg) {
  var key = new Buffer( b64url.b64( b64safeKey ), 'base64' )
  var hmac = crypto.createHmac( alg, key ).update( input )
  var inputSignature = b64url.safe( hmac.digest( 'base64' ) )
  return (inputSignature === signature)
}
1075765
def getsignaturefromtext(text, objname):
    """"""
    if isinstance(text, dict):
        text = text.get('docstring', '')
    # Regexps
    oneline_re = objname + r'\([^\)].+?(?<=[\w\]\}\'"])\)(?!,)'
    multiline_re = objname + r'\([^\)]+(?<=[\w\]\}\'"])\)(?!,)'
    multiline_end_parenleft_re = r'(%s\([^\)]+(\),\n.+)+(?<=[\w\]\}\'"])\))'
    # Grabbing signatures
    if not text:
        text = ''
    sigs_1 = re.findall(oneline_re + '|' + multiline_re, text)
    sigs_2 = [g[0] for g in re.findall(multiline_end_parenleft_re % objname, text)]
    all_sigs = sigs_1 + sigs_2
    # The most relevant signature is usually the first one. There could be
    # others in doctests but those are not so important
    if all_sigs:
        return all_sigs[0]
    else:
        return ''
809012
def get_contents_sig(self):
        

        try:
            return self.contentsig
        except AttributeError:
            pass

        executor = self.get_executor()

        result = self.contentsig = SCons.Util.MD5signature(executor.get_contents())
        return result
966355
def _compute_signature(parameters, access_key_secret):
    '''
    
    '''

    def percent_encode(line):
        if not isinstance(line, six.string_types):
            return line

        s = line
        if sys.stdin.encoding is None:
            s = line.decode().encode('utf8')
        else:
            s = line.decode(sys.stdin.encoding).encode('utf8')
        res = _quote(s, '')
        res = res.replace('+', '%20')
        res = res.replace('*', '%2A')
        res = res.replace('%7E', '~')
        return res

    sortedParameters = sorted(list(parameters.items()), key=lambda items: items[0])

    canonicalizedQueryString = ''
    for k, v in sortedParameters:
        canonicalizedQueryString += '&' + percent_encode(k) \
            + '=' + percent_encode(v)

    # All aliyun API only support GET method
    stringToSign = 'GET&%2F&' + percent_encode(canonicalizedQueryString[1:])

    h = hmac.new(to_bytes(access_key_secret + "&"), stringToSign, sha1)
    signature = base64.encodestring(h.digest()).strip()
    return signature
929092
def _data_to_sign(self) -> bytes:
        
        packed = self.packed()

        field = type(packed).fields_spec[-1]
        assert field.name == 'signature', 'signature is not the last field'

        # this slice must be from the end of the buffer
        return packed.data[:-field.size_bytes]
668748
def _decode_token_compact(token):
    
    header, payload, raw_signature, signing_input = _unpack_token_compact(token)
    token = { 
        "header": header,
        "payload": payload,
        "signature": base64url_encode(raw_signature)
    }
    return token
1169392
private String getSignature(String str) {
    try {
      MessageDigest md = MessageDigest.getInstance(SHA_STRING);
      md.update(str.getBytes());
      md.update(secretBytes);
      byte[] digest = md.digest();
      return new Base64(0).encodeToString(digest);
    } catch (NoSuchAlgorithmException ex) {
      throw new RuntimeException("Invalid SHA digest String: " + SHA_STRING +
        " " + ex.getMessage(), ex);
    }
  }
31753
def rsa_base64_sign_str(self, plain, b64=True):
        
        with open(self.key_file) as fp:
            key_ = RSA.importKey(fp.read())
            # h = SHA.new(plain if sys.version_info < (3, 0) else plain.encode('utf-8'))
            plain = helper.to_bytes(plain)
            # if hasattr(plain, 'encode'):
            #     plain = plain.encode()
            h = SHA.new(plain)
            cipher = pkcs.new(key_).sign(h)
            cip = base64.b64encode(cipher) if b64 else cipher
            return helper.to_str(cip)
689019
private byte[] getSignature(final Manifest forManifest) throws IOException, GeneralSecurityException {

		final ByteArrayOutputStream bos = new ByteArrayOutputStream();
		final Manifest signatureFile    = new Manifest();
		final Attributes main           = signatureFile.getMainAttributes();
		final MessageDigest md          = MessageDigest.getInstance("SHA1");
		final PrintStream print         = new PrintStream(new DigestOutputStream(new ByteArrayOutputStream(), md), true, "UTF-8");

		main.putValue("Signature-Version", "1.0");

		// Digest of the entire manifest
		forManifest.write(print);
		print.flush();

		main.putValue("SHA1-Digest-Manifest", new String(Base64.encode(md.digest()), "ASCII"));

		final Map<String, Attributes> entries = forManifest.getEntries();

		for (Map.Entry<String, Attributes> entry : entries.entrySet()) {

			// Digest of the manifest stanza for this entry.
			print.print("Name: " + entry.getKey() + "\r\n");

			for (Map.Entry<Object, Object> att : entry.getValue().entrySet()) {
				print.print(att.getKey() + ": " + att.getValue() + "\r\n");
			}

			print.print("\r\n");
			print.flush();

			final Attributes sfAttr = new Attributes();
			sfAttr.putValue("SHA1-Digest", new String(Base64.encode(md.digest()), "ASCII"));

			signatureFile.getEntries().put(entry.getKey(), sfAttr);
		}

		signatureFile.write(bos);

		return bos.toByteArray();
	}
1162273
def _jws_signature(signdata, privkey, algorithm):
    
    signature = algorithm.sign(privkey, signdata)
    return base64url_encode(signature)
27991
def load_signature(stream, original_data):
    """"""
    signature, = list(parse_packets((stream)))
    hash_alg = HASH_ALGORITHMS[signature['hash_alg']]
    digest = digest_packets([{'_to_hash': original_data}, signature],
                            hasher=hashlib.new(hash_alg))
    assert signature['hash_prefix'] == digest[:2]
    return signature, digest
564738
def signed_raw(self) -> str:
        
        raw = self.raw()
        signed = "\n".join(self.signatures)
        signed_raw = raw + signed + "\n"
        return signed_raw
1150134
def verify_signature_unicode(self, address, signature, message):
        """"""
        hexdata = binascii.hexlify(message.encode("utf-8"))
        return self.verify_signature(address, signature, hexdata)
74989
def sign(self):
        """"""
        payload = self._payload()
        sigin = b'.'.join([self.protected.encode('utf-8'), payload])
        signature = self.engine.sign(self.key, sigin)
        return {'protected': self.protected,
                'payload': payload,
                'signature': base64url_encode(signature)}
161006
def make_signature(params, hmac_key):
    
    # produce a list of "key=value" for all entries in params except `h'
    pairs = [x + "=" + ''.join(params[x]) for x in sorted(params.keys()) if x != "h"]
    sha = hmac.new(hmac_key, '&'.join(pairs), hashlib.sha1)
    return base64.b64encode(sha.digest())
1038819
public function getEncoded()
    {
        $data = serialize($this->data);
        if (function_exists('gzdeflate'))
        {
            $data = gzdeflate($data);
        }
        $data = base64_encode($data);
        $data .= $this->signature($data);
        return $data;
    }