
    Ϫf                         d Z ddlZddlmZ ddlmZ ddlmZ g dZd Z	ddZ
d	 Zdd
Zd Z e edddd            d        Zy)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                  dt        |             | z   S )z
    net string
    zutf-8!L)
isinstancestrencodestructpacklen)ts    :/usr/lib/python3/dist-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           	          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   )datar   mpr   r    lengths         r   r	   r	   6   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
    N )r   r   r    s      r   r
   r
   G   s    
  6Hr   Twisted      c                       y )Nr2   r2   r   r   installr7   Q   s     	r   )r#   )__doc__r   cryptography.utilsr   twisted.python.deprecater   twisted.python.versionsr   __all__r   r   r   r	   r
   r7   r2   r   r   <module>r=      sZ   
  + / +
/)
 +#" GIr1a()	 *	r   