o
    ӷ6ib                     @   s\   d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ G dd deZd	S )
    )AppConf)default_backend)hashes)pbkdf2)settingsforce_bytesc                   @   s@   e Zd Ze Ze ZdZdZ	G dd dZ
dd Zdd ZdS )	CryptographyConfNzdjango-cryptographyc                   @   s   e Zd ZdZdZdS )zCryptographyConf.MetacryptographyTN)__name__
__module____qualname__prefixproxy r   r   ]/var/www/hoanhtaovolam_webdjango/env/lib/python3.10/site-packages/django_cryptography/conf.pyMeta   s    r   c                 C   s   t |S )Nr   )selfvaluer   r   r   configure_salt   s   zCryptographyConf.configure_saltc                 C   sZ   | j d }| j d }| j d }tj||j|d|d}|t| j d p$tj| j d< | j S )NBACKENDDIGESTSALTi0u  )	algorithmlengthsalt
iterationsbackendKEY)configured_datar   
PBKDF2HMACdigest_sizederiver   r   
SECRET_KEY)r   r   digestr   kdfr   r   r   	configure   s   



zCryptographyConf.configure)r   r   r   r   r   r   SHA256r   r   r   r   r   r&   r   r   r   r   r	   	   s    r	   N)appconfr   cryptography.hazmat.backendsr   cryptography.hazmat.primitivesr   "cryptography.hazmat.primitives.kdfr   django.confr   django.utils.encodingr   r	   r   r   r   r   <module>   s    