Current File : //usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pyo
�
�
5Xc@s�dZddlZddlZddlmZd�Zd�Zdj�Zdd�Z	dd	�Z
dd
�Zd�Ze
dkr�e�ndS(
sLpasslib.crypto._blowfish._gen_files - meta script that generates unrolled.pyi����N(tirangecs#dj�fd�t|�D��S(Ns, c3s|]}�t|�VqdS(N(tstr(t.0tx(tname(sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pys	<genexpr>s(tjoinR(Rtcount((RsG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytvarlistscs,|jd�}dj�fd�|D��S(sident block of texts
c3s%|]}|r�|ndVqdS(tN((Rtline(tpadding(sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pys	<genexpr>s(tsplitR(tblockR
tlines((R
sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytindent_blockss                ((((S0[l >> 24] + S1[(l >> 16) & 0xff]) ^ S2[(l >> 8) & 0xff]) +
                  S3[l & 0xff]) & 0xffffffff)
icCs`xYtddd�D]E}||dd|d|dd|dd	td
tjdd��qWdS(
Niiis�            # Feistel substitution on left word (round %(i)d)
            r ^= %(left)s ^ p%(i1)d

            # Feistel substitution on right word (round %(i1)d)
            l ^= %(right)s ^ p%(i2)d
        titi1iti2tlefttrighttltr(RtBFSTRtreplace(twritetindentR((sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytrender_encipher s cCs3||d�t||d�||dd�dS(Ns2        def encipher(self, l, r):
            """blowfish encipher a single 64-bit block encoded as two 32-bit ints"""

            (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
              p10, p11, p12, p13, p14, p15, p16, p17) = self.P
            S0, S1, S2, S3 = self.S

            l ^= p0

            is$
        return r ^ p17, l

        (R(RR((sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytwrite_encipher_function,s


c	Cs||d�x+td�D]}||ddd|�qW||dd�t||d�||dd�xmtddd�D]Y}||dd	d|d
|d�t||d�||ddd|d
|d�q�W||dd�t||d
�||d
d�dS(Ns�        def expand(self, key_words):
            """unrolled version of blowfish key expansion"""
            ##assert len(key_words) >= 18, "size of key_words must be >= 18"

            P, S = self.P, self.S
            S0, S1, S2, S3 = S

            #=============================================================
            # integrate key
            #=============================================================
        iis9            p%(i)d = P[%(i)d] ^ key_words[%(i)d]
        RsT
        #=============================================================
        # update P
        #=============================================================

        #------------------------------------------------
        # update P[0] and P[1]
        #------------------------------------------------
        l, r = p0, 0

        s-
        p0, p1 = l, r = r ^ p17, l

        is�            #------------------------------------------------
            # update P[%(i)d] and P[%(i1)d]
            #------------------------------------------------
            l ^= p0

            Rs=            p%(i)d, p%(i1)d = l, r = r ^ p17, l

            s
        #------------------------------------------------
        # save changes to original P array
        #------------------------------------------------
        P[:] = (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9,
          p10, p11, p12, p13, p14, p15, p16, p17)

        #=============================================================
        # update S
        #=============================================================

        for box in S:
            j = 0
            while j < 256:
                l ^= p0

        isU
                box[j], box[j+1] = l, r = r ^ p17, l
                j += 2
        (RR(RRR((sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytwrite_expand_function@s*






cs}tjjtjjt�d�}t|d���fd�}|dd�t|dd�t|dd�|dd�dS(	Nsunrolled.pytwcsw|jdt�}|r%||;}n|sFtj|jd��}n|rft|d|d�}n�j|�dS(Ntliteralt i(tpoptFalsettextwraptdedenttrstripRR(RtmsgtkwdsR(tfh(sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pyR�s
isJ        """passlib.crypto._blowfish.unrolled - unrolled loop implementation of bcrypt,
        autogenerated by _gen_files.py

        currently this override the encipher() and expand() methods
        with optimized versions, and leaves the other base.py methods alone.
        """
        #=================================================================
        # imports
        #=================================================================
        # pkg
        from passlib.crypto._blowfish.base import BlowfishEngine as _BlowfishEngine
        # local
        __all__ = [
            "BlowfishEngine",
        ]
        #=================================================================
        #
        #=================================================================
        class BlowfishEngine(_BlowfishEngine):

        Ris]            #=================================================================
            # eoc
            #=================================================================

        #=================================================================
        # eof
        #=================================================================
        (tostpathRtdirnamet__file__tfileRR(ttargetR((R'sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pytmain�s!
t__main__(t__doc__R(R"tpasslib.utils.compatRRRtstripRRRRR.t__name__(((sG/usr/lib/python2.7/site-packages/passlib/crypto/_blowfish/_gen_files.pyt<module>s		U	2