File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/Cryptodome/Hash/__pycache__/TupleHash128.cpython-310.pyc
Back
o ;j� � @ sL d dl mZmZmZ ddlmZ ddlmZmZ G dd� de�Z dd� Z d S ) � )�bord�is_bytes�tobytes� )� cSHAKE128)�_encode_str� _right_encodec @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� ZdS ) � TupleHashz\A Tuple hash object. Do not instantiate directly. Use the :func:`new` function. c C s || _ |�d|d�| _d | _d S )N� s TupleHash)�digest_sizeZ_new�_cshake�_digest)�self�customZcshaker � r �P/opt/saltstack/salt/lib/python3.10/site-packages/Cryptodome/Hash/TupleHash128.py�__init__+ s zTupleHash.__init__c G s@ | j dur td��|D ]}t|�std��| j�t|�� q| S )z�Authenticate the next tuple of byte strings. TupleHash guarantees the logical separation between each byte string. Args: data (bytes/bytearray/memoryview): One or more items to hash. Nz6You cannot call 'update' after 'digest' or 'hexdigest'z#You can only call 'update' on bytes)r � TypeErrorr r �updater )r �data�itemr r r r 2 s zTupleHash.updatec C s6 | j du r| j�t| jd �� | j�| j�| _ | j S )z�Return the **binary** (non-printable) digest of the tuple of byte strings. :return: The hash digest. Binary form. :rtype: byte string N� )r r r r r �read�r r r r �digestD s zTupleHash.digestc C s d� dd� t| �� �D ��S )z�Return the **printable** digest of the tuple of byte strings. :return: The hash digest. Hexadecimal encoded. :rtype: string � c S s g | ]}d t |� �qS )z%02x)r )�.0�xr r r � <listcomp>X s z'TupleHash.hexdigest.<locals>.<listcomp>)�join�tupler r r r r � hexdigestQ s zTupleHash.hexdigestc K s( d|vr d|vr | j |d<