Completed initial implementations of encrypt and decrypt.