# Path: ricloud/compat.py
# PY3 = sys.version_info[0] >= 3
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
# 
# Path: ricloud/utils.py
# def encode_b64(data):
#     return base64.b64encode(data)
# 
# def decode_b64(data):
#     return base64.b64decode(data)
# 
# def generate_timestamp():
#     return int(time.time())


import hmac
import hashlib
from ricloud import compat
from ricloud.utils import encode_b64, decode_b64, generate_timestamp
from __future__ import absolute_import, unicode_literals




DEFAULT_ALGORITHM = hashlib.sha256


def hmac_sign(message, key, algorithm=None):
    """Get a hmac signature of a message using the give key."""
    algorithm = algorithm or DEFAULT_ALGORITHM

    return hmac.new(

# Path: ricloud/compat.py
# PY3 = sys.version_info[0] >= 3
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
#     def want_bytes(data):
#     def want_text(data):
#     def to_str(data):
# 
# Path: ricloud/utils.py
# def encode_b64(data):
#     return base64.b64encode(data)
# 
# def decode_b64(data):
#     return base64.b64decode(data)
# 
# def generate_timestamp():
#     return int(time.time())


# Path: ricloud/signing.py
import hmac
import hashlib
from ricloud import compat
from ricloud.utils import encode_b64, decode_b64, generate_timestamp

from __future__ import absolute_import, unicode_literals




DEFAULT_ALGORITHM = hashlib.sha256


def hmac_sign(message, key, algorithm=None):
    """Get a hmac signature of a message using the give key."""
    algorithm = algorithm or DEFAULT_ALGORITHM

    return hmac.new(

        compat.want_bytes(key), compat.want_bytes(message), digestmod=algorithm