CI_Encryption: Optimizations and test cases