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

All Samples(7)  |  Call(6)  |  Derive(0)  |  Import(1)
Given a string s and a 16-byte key key, computes the AES counter-mode
encryption of s using k.  The counter begins at idx.

        def ctr_crypt(s, key, idx=0):
    """Given a string s and a 16-byte key key, computes the AES counter-mode
       encryption of s using k.  The counter begins at idx.
    """
    if isinstance(key, StringType):
        key = _ml.aes_key(key)
    return _ml.aes_ctr128_crypt(key,s,idx)
        


src/m/i/mixminion-HEAD/lib/mixminion/BuildMessage.py   mixminion(Download)
        #startIdx = paddingLen - 256 + totalSize - len(lastJunk)
        startIdx = HEADER_LEN - ENC_SUBHEADER_LEN - len(lastJunk)
        nextJunk = Crypto.ctr_crypt(nextJunk, headerKey, startIdx)
        junkSeen.append(nextJunk)
 
 
        # Encrypt the symmetrically encrypted part of the header
        header = Crypto.ctr_crypt(header, headerKeys[i])
 
        # What digest will the next server see?

src/m/i/mixminion-HEAD/lib/mixminion/server/PacketHandler.py   mixminion(Download)
 
        # Decrypt the rest of header 1, encrypting the padding.
        header1 = Crypto.ctr_crypt(header1, header_sec_key)
 
        # If the subheader says that we have extra routing info that didn't

src/m/i/mixminion-HEAD/lib/mixminion/ClientUtils.py   mixminion(Download)
     createPrivateDir, floorDiv, previousMidnight, readFile, \
     succeedingMidnight, writeFile, armorText, unarmorText, MixFatalError
from mixminion.Crypto import sha1, ctr_crypt, DIGEST_LEN, AES_KEY_LEN, \
     getCommonPRNG, trng
 
    s = s[SALT_LEN:]
    key = sha1(salt+password+salt)[:AES_KEY_LEN]
    s = ctr_crypt(s, key)
    data = s[:-DIGEST_LEN]
    digest = s[-DIGEST_LEN:]
    key = sha1(salt+password+salt)[:AES_KEY_LEN]
    digest = sha1("".join([data,salt,magic]))
    encrypted = ctr_crypt(data+digest, key)
    contents = "".join([magic,"\x00",salt,encrypted])
    writeFile(fname, armorText(contents,

src/m/i/mixminion-HEAD/lib/mixminion/testSupport.py   mixminion(Download)
    txt = "Hello world!"
    print "   Example text M:",hexStr(txt)
    print "   Encrypt(K,M):",hexStr(mixminion.Crypto.ctr_crypt(txt,k))
 
def tvLIONESS():