= pycrypto =
Collection of both secure hash functions (such as MD5 and SHA),
and various encryption algorithms (AES, DES, IDEA, RSA, ElGamal, etc.).

== SlackBuild ==
 * su
 * cd /tmp
 * wget http://slackbuilds.org/slackbuilds/14.1/python/pycrypto.tar.gz
 * tar xvzf pycrypto.tar.gz
 * cd pycrypto
 * wget http://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz
 * ./pycrypto.SlackBuild 
 * installpkg /tmp/pycrypto-2.6.1-i486-1_SBo.tgz

== Sample code ==
{{{#!highlight python
from Crypto.Cipher import ARC4
from Crypto.Cipher import AES
from Crypto.Cipher import XOR
from Crypto import Random

texts=['1234','1234','01234A','ABC','ABC','CCCCCCC','CCCCCCC']

def getHex(data):
    ret=''
    for c in data:
        ret='%s%02X'%(ret,ord(c))
    return ret

def testARC4(key):
    print '= ARC4 ='
    cipher = ARC4.new(key)
    encrypted=[]
    for text in texts:
        encx=cipher.encrypt(text)
        encrypted.append(encx)
        print 'Orig:%s Encrypted:%s'%(text,getHex(encx))

    cipherDec = ARC4.new(key)
    for encd in encrypted:
        decrypted = cipherDec.decrypt(encd)
        print 'Decrypted:%s'%(decrypted)

def testAES1(key):
    print '= AES ='
    iv = Random.new().read(AES.block_size)
    print 'IV: %s'%(getHex(iv))
    cipher = AES.new(key,AES.MODE_CFB,iv)
    encrypted=[]
    for text in texts:
        encx=cipher.encrypt(text)
        encrypted.append(encx)
        print 'Orig:%s Encrypted:%s'%(text,getHex(encx))

    cipherDec = AES.new(key,AES.MODE_CFB,iv)
    for encd in encrypted:
        decrypted = cipherDec.decrypt(encd)
        print 'Decrypted:%s'%(decrypted)

def testXOR(key):
    print '= XOR ='
    cipher = XOR.new(key)
    encrypted=[]
    for text in texts:
        encx=cipher.encrypt(text)
        encrypted.append(encx)
        print 'Orig:%s Encrypted:%s'%(text,getHex(encx))

    cipherDec = XOR.new(key)
    for encd in encrypted:
        decrypted = cipherDec.decrypt(encd)
        print 'Decrypted:%s'%(decrypted)


if __name__=='__main__':
    key='1234567890123456'
    testARC4(key) 
    testAES1(key)
    testXOR(key)

}}}