Ejemplo n.º 1
0
def test_modules1():
    """Test standard modules that have internal test functions defined"""
    for name in modules:
    	print "MODULES1: Testing " + name
        mod = loadModule(name)
        test = getattr(mod, 'test')
        test()
        print "MODULES1: Done test on " + name
Ejemplo n.º 2
0
def test_pwcrypt():
    from pisces import pwcrypt
    password = "******"
    for line in fileinput.input('test/pwcrypt_input'):
        salt, iters, hashname, key = eval(line)
        hash = loadModule('Crypto.Hash.%s' % hashname)
        kdf = pwcrypt.KeyDerivationFactory(len(key), len(salt), iters,
                                           hash=hash)
        regen = kdf.recreateKey(password, salt)
        assert key == regen, \
               "pisces.pwcrypt: failed to recreate key, %s" % line