File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/__pycache__/hashutils.cpython-310.pyc
Back
o ;j� � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddl Zddl mZ ed�dd� �Zed�dd � �Z d d� Zdd � Zed�dd� �Zed�dd� �Zed�dd� �Zed�dd� �Zed�dd� �Zed�dd� �Zed�ed �d)d"d ���Zed#�d*d%d&��ZG d'd(� d(�ZdS )+z- A collection of hashing and encoding utils. � N)�jinja_filterZ base64_encodec C �6 t jjjt�t jj�| ��t jj�� rdd�S dd�S )z� Encode a string as base64 using the "modern" Python interface. Among other possible differences, the "modern" encoder does not include newline ('\n') characters in the encoded output. �utf8N��encoding) �salt�utils�stringutils� to_unicode�base64� b64encode�to_bytes�platform� is_windows��instr� r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/hashutils.py�base64_b64encode � ��r Z base64_decodec C sV t �tjj�| ��}ztjjj|tjj�� rdd�W S dd�W S t y* | Y S w )zM Decode a base64-encoded string using the "modern" Python interface. r Nr ) r � b64decoder r r r r r r �UnicodeDecodeError)r �decodedr r r �base64_b64decode s ���r c C r )a Encode a byte-like object as base64 using the "modern" Python interface. Among other possible differences, the "modern" encoder includes a newline ('\n') character after every 76 characters and always at the end of the encoded string. r Nr ) r r r r r �encodebytesr r r r r r r �base64_encodestring- r r c C sZ t jj�| �}t�|�}zt jjj|t jj�� rdd�W S dd�W S t y, | Y S w )zW Decode a base64-encoded byte-like object using the "modern" Python interface. r Nr ) r r r r r �decodebytesr r r r )r Zbvaluer r r r �base64_decodestring; s ���r �md5c C �"