o ¯b¢ã@s‚dZddlZddlmZddlmZddlmZgd¢Zdd„Z dd d „Z d d „Z ddd„Z dd„Z eeddddƒƒdd„ƒZdS)z@ Common functions for the SSH classes. Maintainer: Paul Swartz éN)Ú int_to_bytes)Ú deprecated)ÚVersion)ÚNSÚgetNSÚMPÚgetMPÚffscCs(t|tƒr | d¡}t dt|ƒ¡|S)z net string zutf-8ú!L)Ú isinstanceÚstrÚencodeÚstructÚpackÚlen)Út©rú:/usr/lib/python3/dist-packages/twisted/conch/ssh/common.pyrs  récCspg}d}t|ƒD]$}t d|||d…¡\}| ||dd||…¡|d|7}qt|ƒ||d…fS)z get net string rr éN)ÚrangerÚunpackÚappendÚtuple)ÚsÚcountÚnsÚcÚiÚlrrrrs rcCsP|dkrdS|dks J‚t|ƒ}t|dd…ƒd@rd|}t dt|ƒ¡|S)Nrsré€óú>L)rÚordrrr)ÚnumberÚbnrrrr,s rc Csxg}d}t|ƒD](}t d|||d…¡\}| t ||d|d|…d¡¡|d|7}qt|ƒ||d…fS)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. rr"rÚbigN)rrrrÚintÚ from_bytesr)ÚdatarÚmprrÚlengthrrrr6s &rcCs|D] }||vr |SqdS)zs first from second goes through the first list, looking for items in the second, returns the first one Nr)rrrrrrr Gs ÿÿr ÚTwistedéécCsdS)NrrrrrÚinstallQsr/)r)Ú__doc__rÚcryptography.utilsrÚtwisted.python.deprecaterÚtwisted.python.versionsrÚ__all__rrrrr r/rrrrÚs