????
Current Path : /lib/python3.6/site-packages/glances/__pycache__/ |
Current File : //lib/python3.6/site-packages/glances/__pycache__/password.cpython-36.pyc |
3 Eo�c � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m Z ddlmZ ddl mZ ddlmZ G dd � d e�ZdS ) zManage password.� N)�open)�b�input)�user_config_dir)� safe_makedirs)�loggerc @ s\ e Zd ZdZddd�Zdd� Zdd � Zd d� Zdd � Zdd� Z ddd�Z dd� Zdd� ZdS )�GlancesPasswordz9This class contains all the methods relating to password.�glancesNc C s: || _ || _| j� | _| j d | _tjj| j| j�| _d S )Nz.pwd) �username�config�local_password_path�password_dirZpassword_filename�os�path�join� password_file)�selfr r � r �/usr/lib/python3.6/password.py�__init__ s zGlancesPassword.__init__c C s( | j dkrt� S | j jddt� d�S dS )zzReturn the local password path. Related toissue: Password files in same configuration dir in effect #2143 NZ passwordsr )�default)r r Z get_value)r r r r r % s z#GlancesPassword.local_password_pathc C s t jt|��j� S )z)Return the SHA-256 of the given password.)�hashlib�sha256r � hexdigest)r �plain_passwordr r r �sha256_hash. s zGlancesPassword.sha256_hashc C s t j|j� |j� �j� S )z+Return the hashed password, salt + SHA-256.)r r �encoder )r �saltr r r r �get_hash2 s zGlancesPassword.get_hashc C s"