Implement encryption algorithm