Implement encrypt and decrypt