It's very wide question and the variety of ways to do that.
First of all, you need to choose a method of the encryption and purpose why you encrypt the data.
There are 3 main encryption methods:
1. Symmetric Encryption
Encrypter and Decrypter have access to the same key. It's quite easy, but it has one big drawback - key needs to be shared, so if you put it to the client it can be stolen and abused.
As a solution, you would need to use some another method to send the key and encrypt it on the client.
2. Asymmetric Encryption
With asymmetric encryption, the situation is different. To encrypt data you need to use public/private key pair.
The public key is usually used to encrypt data, but decryption is possible only with a private key. So you can hand out public key to your clients, and they would be able to send some encrypted traffic back to you.
But still you need to be sure that you are talking to the right public key to not abuse your encryption.
Usually, it's used in TLS (SSL), SSH, signing updates, etc.
3. Hashing (it's not really encryption)
It's the simplest. With hashing, you produce some spring that can't be reverted, but with a rule that same data will produce the same hash.
So you could just pick the most suitable method and try to find appropriate package in the language you use.