获取一个字符串的 sha256 哈希值

        :param:
            * message: (string) 需要进行哈希的字符串
        :return:
            * hashed_str: sha256 算法哈希值
172854
def hashlib_sha256(message):
        
        hashlib_sha256 = hashlib.sha256()
        hashlib_sha256.update(message.encode('utf-8'))
        hashed_str = hashlib_sha256.hexdigest()
        return hashed_str
434867
protected function hash($message)
    {
        $hash = hash_hmac(
            'sha256',
            $message,
            $this->appClientSecret,
            true
        );

        return base64_encode($hash);
    }
625194
def decrypt(self, message):
        

        # Unserialize the encrypted message
        message = json.loads(message)

        # Set up a list for the unencrypted lines of the message
        unencrypted_msg = []

        for line in message:

            # Convert from ascii back to bytestring
            enc_line = binascii.a2b_base64(line)

            # Decrypt the line using our private key
            unencrypted_line = rsa.decrypt(enc_line, self.private_key)

            unencrypted_msg.append(unencrypted_line)

        # Convert the message from a list back into a string
        unencrypted_msg = "".join(unencrypted_msg)

        return unencrypted_msg
103075
def crypto_hash_sha256(message):
    
    digest = ffi.new("unsigned char[]", crypto_hash_sha256_BYTES)
    rc = lib.crypto_hash_sha256(digest, message, len(message))
    ensure(rc == 0,
           'Unexpected library error',
           raising=exc.RuntimeError)
    return ffi.buffer(digest, crypto_hash_sha256_BYTES)[:]
537804
def signatureJWT(self, message):
        
        return hmac.new(
            key=self.secretkey,
            msg=message,
            digestmod=hashlib.sha256
        ).hexdigest()
401731
def get_hash_as_int(*args, group: cmod.PairingGroup = None):
    

    group = group if group else cmod.PairingGroup(PAIRING_GROUP)
    h_challenge = sha256()

    serialedArgs = [group.serialize(arg) if isGroupElement(arg)
                    else cmod.Conversion.IP2OS(arg)
                    for arg in args]

    for arg in sorted(serialedArgs):
        h_challenge.update(arg)
    return bytes_to_int(h_challenge.digest())
807387
def sha256sum(path, blocksize=65536):
    
    sig = hashlib.sha256()
    with open(path, 'rb') as f:
        buf = f.read(blocksize)
        while len(buf) > 0:
            sig.update(buf)
            buf = f.read(blocksize)
    return sig.hexdigest()
1270204
def message
      return {} unless params[:_message]
      begin
        Marshal.load(Merb::Parse.unescape(params[:_message]).unpack("m").first)
      rescue ArgumentError, TypeError
        {}
      end
    end
505099
def message(self, message=None):
        
        if message is not None:
            self.response_model.message = message
        return self.response_model.message
1354193
def message(self):
        
        message = self.description.format(**self.parameters)
        return '{code} {message}'.format(code=self.code, message=message)
617103
public static String sha256(String string) throws NoSuchAlgorithmException, UnsupportedEncodingException {
        MessageDigest messageDigest;
        messageDigest = MessageDigest.getInstance("SHA-256");
        byte[] hash = messageDigest.digest(string.getBytes("UTF-8"));
        return String.valueOf(Hex.encodeHex(hash));
    }
1371026
def bitcoin_sig_hash(message):
    
    padded = b'\x18Bitcoin Signed Message:\n' +\
        int_to_var_bytes(len(message)) +\
        message
    return double_sha256(padded)
922261
def checkMessageSignature(self, message):
        
        message_sig = message.getArg(OPENID_NS, 'sig')
        if not message_sig:
            raise ValueError("%s has no sig." % (message,))
        calculated_sig = self.getMessageSignature(message)
        return cryptutil.const_eq(calculated_sig, message_sig)
419375
def hash(value):
    ''''''
    if not value:
        return
    elif len(value) == 32:
        type = 'md5'
    elif len(value) == 40:
        type = 'sha1'
    elif len(value) == 64:
        type = 'sha256'
    else:
        return None
    return {'type': type, 'value': value}
882625
def _get_sha256_digest(self, content):
        
        content_sha256 = base64.b64encode(SHA256.new(content).digest())
        return 'SHA256=' + content_sha256
272781
def parse_message(
        self, body, timestamp=None, nonce=None, msg_signature=None
    ):
        
        message_dict = parse_xml(body)
        if "Encrypt" in message_dict:
            xml = self.crypto.decrypt_message(
                timestamp=timestamp,
                nonce=nonce,
                msg_signature=msg_signature,
                encrypt_msg=message_dict["Encrypt"]
            )
            message_dict = parse_xml(xml)
        return process_message(message_dict)
1188675
def get_hmac(message):
    
    key = current_app.config['WEBHOOKS_SECRET_KEY']
    hmac_value = hmac.new(
        key.encode('utf-8') if hasattr(key, 'encode') else key,
        message.encode('utf-8') if hasattr(message, 'encode') else message,
        sha1
    ).hexdigest()
    return hmac_value