PHP encryption methods for passwords and other sensitive data

Click for: original source

Ashley Rich published this article about various methods of protecting sensitive data in PHP. There is a range of different encryption methods in use today, the most common being hashing, secret key encryption and public key encryption. Also in PHP 7.2+ you have cryptography extension Sodium which should simplify vastly complicated cryptography landscape.

Each encryption method has multiple algorithms or ciphers to choose from (each with their own strengths and weaknesses). The article then dives into hashing and secret key encryption:

A hashing algorithm takes an input value and transforms it to a message digest.

It’s worth noting that hashing isn’t a bulletproof solution and not all hashing algorithms are equal. At the time of publishing this hashing algorithms such as bcrypt or Argon2 are recommended.

Find how to use Sodium for Secret Key Encryption, or what Envelope Encryption is. You will get code examples and links to further reading, too. Stay safe!

[Read More]

Tags php infosec crypto