The following process of encrypting is called End-to-End encryption used between two devices.
Both devices have a Public and a Private Key. These devices are anything that can communicate with other devices and can range from cell phones to personal computers or anything that can communicate with other devices.
When these two devices are communicating with each other, then they both swap there own public keys while also remembering what there public key was.
Once each device has the other device's key, then the keys are combined into two shared keys which allow the conversation be encrypted. Meanwhile, the devices use there public key copies to confirm that these shared keys are authentic.
These shared keys are then repeatedly discarded and replaced with new shared keys preventing any unwanted threats from accessing the information transferring between the two devices.
Fun Fact: More than 300,000,000,000,000,000,000,000,000,000,000,000 (300 decillion) key combinations.
The possibility of someone hacking into the data being transferred between the two devices are highly unlikely due to the massive amount of possible key combinations there are.