Encrypts the given data. It uses a lock to ensure thread safety.
The encrypted data.
The data to encrypt.