#! /usr/local/bin/python

from mcrypt import *

tupAlgos = ("rijndael-128", "rijndael-256", "blowfish", "twofish", "tripledes", "saferplus", "cast-256")
tupModes = ("cbc", "cfb", "ofb", "ecb", "nofb", "ncfb")
strTestString = "This is just a sample text line to see what is going on"

while (len(strTestString) % 8 != 0):
	strTestString += " "

for algo in tupAlgos:

    print "Algorithm:"
    print algo

    for mode in tupModes:

        m = MCRYPT(algo, mode)
        m.init("X"*m.get_key_size())
        data = m.encrypt(strTestString, fixlength=1)
        m.reinit()
        newData = m.decrypt(data, fixlength=1)

        if newData != strTestString:

            print mode + " failed"

