
    Vh                        d Z ddlmZ ddlZddlmZmZ ddlmZ ddl	m
Z
 ddlmZ g dZdd	Zddd
ZddZedd       Zedd       ZdddZd Z e
 edddd            d        Zy)z'
Common functions for the SSH classes.
    )annotationsN)Sequenceoverload)int_to_bytes)
deprecated)Version)NSgetNSMPgetMPffsc                    t        | t              r| j                  d      } t        j                  dt        |             | z   S )z
    net string
    zutf-8!L)
isinstancestrencodestructpacklen)ts    H/home/dcms/DCMS/lib/python3.12/site-packages/twisted/conch/ssh/common.pyr	   r	      s6     !SHHW;;tSV$q((    c                    g }d}t        |      D ]E  }t        j                  d| ||dz          \  }|j                  | |dz   d|z   |z           |d|z   z  }G t	        |      | |d fz   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\ }}T1QQ<0
		!AEAEAI&'	QU
 9!"xr   c                    | dk(  ry| dkD  sJ t        |       }t        |dd       dz  rd|z   }t        j                  dt	        |            |z   S )Nr   s                 >L)r   ordr   r   r   )numberbns     r   r   r   +   sW    {A::	f	B
2a7|cr\;;tSW%**r   c                     y N )datas    r   r   r   5       r   c                     y r.   r/   )r0   r    s     r   r   r   :   r1   r   c           	         g }d}t        |      D ]Y  }t        j                  d| ||dz          \  }|j                  t        j                  | |dz   |dz   |z    d             |d|z   z  }[ t        |      | |d fz   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)   r   bigN)r   r   r   r   int
from_bytesr   )r0   r    mpr"   r#   lengths         r   r   r   ?   s     
B	A5\ MM$QQ8	
		#..a!ea!efn!=uEF	QZ 9QR{""r   c                "    | D ]
  }||v s|c S  y)zs
    first from second
    goes through the first list, looking for items in the second, returns the first one
    Nr/   )r"   r   r#   s      r   r   r   P   s    
  6Hr   Twisted      c                      y r.   r/   r/   r   r   installr>   Z   s     	r   )r   zbytes | strreturnbytes)r&   )r   r@   r    r5   r?   zSequence[bytes])r+   r5   r?   r@   )r0   r@   r?   ztuple[int, bytes])r0   r@   r    r5   r?   zSequence[int | bytes])__doc__
__future__r   r   typingr   r   cryptography.utilsr   twisted.python.deprecater   twisted.python.versionsr   __all__r	   r
   r   r   r   r>   r/   r   r   <module>rH      s   
 #  % + / +
/)
 + 
 
 
 
#" GIr1a()	 *	r   