File: //usr/lib/python3/dist-packages/S3/__pycache__/Crypto.cpython-310.pyc
o
�Qa, � @ sH d dl mZ d dlZd dlZzd dlmZ W n ey% d dlmZ Y nw ddlm Z d dl
mZ ddlm
Z
mZmZ dd lmZmZmZ dd
lmZ d dlZd dlmZmZ g Zd&d
d�Ze�d� dd� Ze�d� d'dd�Ze�d� dd� Ze�d� dd� Zdd� Z dd� Z! d(d d!�Z"e�d!� d)d"d#�Z#d)d$d%�Z$dS )*� )�absolute_importN)�encodebytes)�encodestring� )�Config)�debug)�encode_to_s3�decode_from_s3�s3_quote)�
time_to_epoch�deunicodise�check_bucket_name_dns_support)�
SortedDict)�sha1�sha256Fc C s� | sdS d}|r
dpd}t | �� �D ],}|r||vrq| | }|dv r0|dt|dd�|f 7 }q|d|t| | dd�f 7 }q|oHd|d d
� S )a�
Format URL parameters from a params dict and returns
?parm1=val1&parm2=val2 or an empty string if there
are no parameters. Output of this function should
be appended directly to self.resource['uri']
- Set "always_have_equal" to always have the "=" char for a param even when
there is no value for it.
- Set "limited_keys" list to restrict the param string to keys that are
defined in it.
� �=)Nr z&%s%sT��unicode_outputz&%s=%s�?r N)�sorted�keysr
)�params�always_have_equal�limited_keys� param_str� equal_str�key�value� r �+/usr/lib/python3/dist-packages/S3/Crypto.py�format_param_str s r! c C s, t � � j}tt�t|�| t��� ��� }|S )a{ Sign a string with the secret key, returning base64 encoded results.
By default the configured secret key is used, but may be overridden as
an argument.
Useful for REST authentication. See http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html
string_to_sign should be utf-8 "bytes".
and returned signature will be utf-8 encoded "bytes".
) r �
secret_keyr �hmac�newr r �digest�strip)�string_to_signr"