File: //opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyc
�
�/�Oc           @   s�   d  Z  d Z d g Z d d l Z e j d d k rT e j d d k rT d d l Tn  d d	 l m Z m Z m	 Z	 d
 e
 f d �  �  YZ d e f d
 �  �  YZ
 d d d d d � Z d e f d �  �  YZ d d � Z d S(   sU   Pure Python implementation of the RSA-related portions of Crypto.PublicKey._fastmath.s   $Id$t
   rsa_constructi����Ni    i   i   (   t   *(   t   sizet   inverset   GCDt   errorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyR   %   s   t   _RSAKeyc           B   sP   e  Z d  �  Z d �  Z d �  Z d �  Z d �  Z d �  Z d �  Z d �  Z	 RS(   c         C   s   | t  | |  j |  j � S(   N(   t   powt   et   n(   t   selft   mt   r(    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _blind)   s    c         C   s   t  | |  j � | |  j S(   N(   R   R   (   R   R
   R   (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _unblind-   s    c         C   s�   |  j  �  s t d � � n  t |  d � r� t |  d � r� t |  d � r� t | |  j |  j d |  j � } t | |  j |  j d |  j � } | | } | d k  r� | |  j } n  | |  j |  j } | |  j | St | |  j |  j � S(   Ns   No private keyt   pt   qt   ui   i    (	   t   has_privatet	   TypeErrort   hasattrR	   t   dR   R   R   R   (   R   t   ct   m1t   m2t   h(    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _decrypt1   s    -##
c         C   s   t  | |  j |  j � S(   N(   R	   R
   R   (   R   R
   (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _encrypt?   s    c         C   s(   |  j  �  s t d � � n  |  j | � S(   Ns   No private key(   R   R   R   (   R   R
   (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _signC   s    c         C   s   |  j  | � | k S(   N(   R   (   R   R
   t   sig(    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyt   _verifyH   s    c         C   s
   t  |  d � S(   NR   (   R   (   R   (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyR   K   s    c         C   s   t  |  j � d S(   s7   Return the maximum number of bits that can be encryptedi   (   R   R   (   R   (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyR   N   s    (
   R   R   R   R   R   R   R   R    R   R   (    (    (    sM   /opt/alt/python27/lib64/python2.7/site-packages/Crypto/PublicKey/_slowmath.pyR   (   s   							c   
      C   s�  t  |  t � s t � t  | t � s* t � t  | t t d � f � sK t � t  | t t d � f � sl t � t  | t t d � f � s� t � t  | t t d � f � s� t � t �  } |  | _ | | _ | d k r� | S| | _ | d k	 r| d k	 r| | _	 | | _
 n>| | d } | } x'