Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)
Given a 16-byte key2 and key4, and a 20-byte key1 and key3, decrypts
s using the LIONESS super-pseudorandom permutation.

        def lioness_decrypt(s,(key1,key2,key3,key4)):
    """Given a 16-byte key2 and key4, and a 20-byte key1 and key3, decrypts
       s using the LIONESS super-pseudorandom permutation.
    """

    assert len(key1)==len(key3)==DIGEST_LEN
    assert len(key2)==len(key4)==DIGEST_LEN
    assert len(s) > DIGEST_LEN

    left = s[:DIGEST_LEN]
    right = s[DIGEST_LEN:]
    del s

    # Slow, comprehensible version:
    #left = strxor(left,  sha1("".join([key4,right,key4])))
    #right = ctr_crypt(right, sha1("".join([key3,left,key3]))[:AES_KEY_LEN])
    #left = strxor(left,  sha1("".join([key2,right,key2])))
    #right = ctr_crypt(right, sha1("".join([key1,left,key1]))[:AES_KEY_LEN])

    # Equivalent-but-faster version:
    left = _ml.strxor(left, _ml.sha1("".join((key4,right,key4))))
    right = _ml.aes_ctr128_crypt(
        _ml.aes_key(_ml.sha1("".join((key3,left, key3)))[:AES_KEY_LEN]),
        right, 0)
    left = _ml.strxor(left, _ml.sha1("".join((key2,right,key2))))
    right = _ml.aes_ctr128_crypt(
        _ml.aes_key(_ml.sha1("".join((key1,left, key1)))[:AES_KEY_LEN]),
        right, 0)

    return left + right
        


src/m/i/mixminion-HEAD/lib/mixminion/server/PacketHandler.py   mixminion(Download)
 
        # Decrypt the payload.
        payload = Crypto.lioness_decrypt(pkt.payload,
                              keys.getLionessKeys(Crypto.PAYLOAD_ENCRYPT_MODE))
 
 
        # Decrypt header 2.
        header2 = Crypto.lioness_decrypt(pkt.header2,
                           keys.getLionessKeys(Crypto.HEADER_ENCRYPT_MODE))
 
        if Packet.typeIsSwap(rt):
            hkey = Crypto.lioness_keys_from_header(header2)
            payload = Crypto.lioness_decrypt(payload, hkey)
 
            hkey = Crypto.lioness_keys_from_payload(payload)
            header2 = Crypto.lioness_decrypt(header2, hkey)

src/m/i/mixminion-HEAD/lib/mixminion/BuildMessage.py   mixminion(Download)
    k = Crypto.Keyset(replyBlock.encryptionKey).getLionessKeys(
                         Crypto.PAYLOAD_ENCRYPT_MODE)
    payload = Crypto.lioness_decrypt(payload, k)
 
    return _buildPacket(payload, None, None,
    k = Crypto.Keyset(rsaPart[:SECRET_LEN]).getLionessKeys(
        Crypto.END_TO_END_ENCRYPT_MODE)
    rest = rsaPart[SECRET_LEN:] + Crypto.lioness_decrypt(rest, k)
 
    # ... and then, check the checksum and continue.

src/m/i/mixminion-HEAD/lib/mixminion/testSupport.py   mixminion(Download)
        txt,(k1,k2,k3,k4)))
    print "   SPRP_Decrypt(K,M):",hexStr(mixminion.Crypto.lioness_decrypt(
        txt,(k1,k2,k3,k4)))
 
def testVectors(name,args):