Ciphers: Adding setEngine() and some optimizations

Ciphers: Adding setEngine() and some optimizations