# Path: knox/settings.py
# USER_SETTINGS = getattr(settings, 'REST_KNOX', None)
# DEFAULTS = {
#     'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512',
#     'AUTH_TOKEN_CHARACTER_LENGTH': 64,
#     'TOKEN_TTL': timedelta(hours=10),
#     'USER_SERIALIZER': None,
#     'TOKEN_LIMIT_PER_USER': None,
#     'AUTO_REFRESH': False,
#     'MIN_REFRESH_INTERVAL': 60,
#     'AUTH_HEADER_PREFIX': 'Token',
#     'EXPIRY_DATETIME_FORMAT': api_settings.DATETIME_FORMAT,
# }
# IMPORT_STRINGS = {
#     'SECURE_HASH_ALGORITHM',
#     'USER_SERIALIZER',
# }
#     TOKEN_KEY_LENGTH = 8
#     DIGEST_LENGTH = 128
# CONSTANTS = CONSTANTS()
# def reload_api_settings(*args, **kwargs):
#     def __setattr__(self, *args, **kwargs):
# class CONSTANTS:


import binascii
from os import urandom as generate_bytes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from knox.settings import knox_settings



sha = knox_settings.SECURE_HASH_ALGORITHM


def create_token_string():
    return binascii.hexlify(

# Path: knox/settings.py
# USER_SETTINGS = getattr(settings, 'REST_KNOX', None)
# DEFAULTS = {
#     'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512',
#     'AUTH_TOKEN_CHARACTER_LENGTH': 64,
#     'TOKEN_TTL': timedelta(hours=10),
#     'USER_SERIALIZER': None,
#     'TOKEN_LIMIT_PER_USER': None,
#     'AUTO_REFRESH': False,
#     'MIN_REFRESH_INTERVAL': 60,
#     'AUTH_HEADER_PREFIX': 'Token',
#     'EXPIRY_DATETIME_FORMAT': api_settings.DATETIME_FORMAT,
# }
# IMPORT_STRINGS = {
#     'SECURE_HASH_ALGORITHM',
#     'USER_SERIALIZER',
# }
#     TOKEN_KEY_LENGTH = 8
#     DIGEST_LENGTH = 128
# CONSTANTS = CONSTANTS()
# def reload_api_settings(*args, **kwargs):
#     def __setattr__(self, *args, **kwargs):
# class CONSTANTS:


# Path: knox/crypto.py
import binascii
from os import urandom as generate_bytes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from knox.settings import knox_settings




sha = knox_settings.SECURE_HASH_ALGORITHM


def create_token_string():
    return binascii.hexlify(

        generate_bytes(int(knox_settings.AUTH_TOKEN_CHARACTER_LENGTH / 2))