ó
BwLc           @   sT   d  d l  Td  d l m Z d  d l Z d d d d e e e d „ Z e d „ Z d S(	   iÿÿÿÿ(   t   *(   t   _counterNt    i   i    c         C   sß   t  |  d ƒ \ } }	 |	 d k r7 t d |  f ƒ ‚ n  | d k  rR t d ƒ ‚ n | d k rm t d ƒ ‚ n  t | | | ƒ }
 | r° t j t | ƒ t | ƒ |
 d | d	 | ƒSt j t | ƒ t | ƒ |
 d | d	 | ƒSd  S(
   Ni   i    s%   nbits must be a multiple of 8; got %di   s   nbits too smalliÿÿ  s   nbits too larget   allow_wraparoundt   disable_shortcut(   t   divmodt
   ValueErrort   _encodeR   t   _newLEt   strt   _newBE(   t   nbitst   prefixt   suffixt   initial_valuet   overflowt   little_endianR   R   t   nbytest	   remaindert   initval(    (    s7   /usr/lib/python2.7/dist-packages/Crypto/Util/Counter.pyt   new   s    +c         C   sz   g  } t  |  ƒ }  xX t | ƒ D]J } | rE | j t |  d @ƒ ƒ n | j d t |  d @ƒ ƒ |  d L}  q Wd j | ƒ S(   Niÿ   i    i   R   (   t   longt   ranget   appendt   chrt   insertt   join(   t   nR   R   t   retvalt   i(    (    s7   /usr/lib/python2.7/dist-packages/Crypto/Util/Counter.pyR   2   s    (   t   Crypto.Util.python_compatt   Crypto.UtilR   t   structt   FalseR   R   (    (    (    s7   /usr/lib/python2.7/dist-packages/Crypto/Util/Counter.pyt   <module>   s   
