createEncryptFunctionWithIv