�
Ϫ�f� � � � d Z ddlZddlmZ ddlmZ ddlmZ g d�Zd� Z dd�Z
d � Zdd
�Zd� Z
e edd
dd� � d� � Zy)z@
Common functions for the SSH classes.
Maintainer: Paul Swartz
� N)�int_to_bytes)�
deprecated)�Version)�NS�getNS�MP�getMP�ffsc � � t | t � r| j d� } t j dt | � � | z S )z
net string
zutf-8�!L)�
isinstance�str�encode�struct�pack�len)�ts �:/usr/lib/python3/dist-packages/twisted/conch/ssh/common.pyr r s6 � � �!�S��
�H�H�W����;�;�t�S��V�$�q�(�(� c �� � g }d}t |� D ]E }t j d| ||dz � \ }|j | |dz d|z |z � |d|z z
}�G t |� | |d fz S )z
get net string
r r � N)�ranger �unpack�append�tuple)�s�count�ns�c�i�ls r r r s� � �
�B� �A�
�5�\� ���}�}�T�1�Q��Q��<�0���
� � �!�A��E�A��E�A�I�&�'� �Q��U�
��� ��9��!�"��x��r c � � | dk( ry| dkD sJ �t | � }t |dd � dz rd|z }t j dt |� � |z S )Nr s � � � �>L)r �ordr r r )�number�bns r r r , sW � �
��{���A�:��:� �f� �B�
�2�a��7�|�c��
�r�\���;�;�t�S��W�%��*�*r c � � g }d}t |� D ]Y }t j d| ||dz � \ }|j t j | |dz |dz |z d� � |d|z z
}�[ t
|� | |d fz S )a=
Get multiple precision integer out of the string. A multiple precision
integer is stored as a 4-byte length followed by length bytes of the
integer. If count is specified, get count integers out of the string.
The return value is a tuple of count integers followed by the rest of
the data.
r r& |