예제 #1
0
    def _hash_list(self, param_list):
        """

        :param list: list as [["key", "value"], ["key2", "value2"]] or [("key", "value"), ("key2", "value2")]
        :return: byte array(octet stream) representation of hashed string
        """
        string = ""
        for pair in param_list:
            string += "{}={}&".format(precent_encode(pair[0]),
                                      precent_encode(pair[1]))
        string = string.rstrip("&")
        return self._hash_string(string)
예제 #2
0
    def _hash_list_and_dict(self, list, dict):
        """

        :param list: list of keys as ["key1", "key2"]
        :param dict: dict as  {"key", "value}
        :return: byte array(octet stream) representation of hashed string
        """
        string = ""
        for key in list:
            string += "{}={}&".format(precent_encode(key),
                                      precent_encode(dict[key]))
        string = string.rstrip("&")
        return self._hash_string(string)