# Path: djenga/encryption/helpers.py
# def _as_bytes(value):
#     if isinstance(value, six.string_types):
#         value = value.encode('utf-8')
#     return value


import logging
    import uuid
from base64 import b64decode
from base64 import b64encode
from Crypto.Protocol.KDF import PBKDF2 as derive_key
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from django.conf import settings
from .helpers import _as_bytes
# encoding: utf-8



__all__ = [
    u'encrypt',
    u'encrypt_bytes',
    u'decrypt',
    u'decrypt_bytes',
]


logger = logging.getLogger(__name__)


def _prep_key(key=None):
    key = key or settings.DJENGA_ENCRYPTION_KEY

# Path: djenga/encryption/helpers.py
# def _as_bytes(value):
#     if isinstance(value, six.string_types):
#         value = value.encode('utf-8')
#     return value


# Path: djenga/encryption/gcm.py
import logging
    import uuid
from base64 import b64decode
from base64 import b64encode
from Crypto.Protocol.KDF import PBKDF2 as derive_key
from Crypto.Cipher import AES
from Crypto.Random import get_random_bytes
from django.conf import settings
from .helpers import _as_bytes

# encoding: utf-8



__all__ = [
    u'encrypt',
    u'encrypt_bytes',
    u'decrypt',
    u'decrypt_bytes',
]


logger = logging.getLogger(__name__)


def _prep_key(key=None):
    key = key or settings.DJENGA_ENCRYPTION_KEY

    return _as_bytes(key)