Posts Tagged ‘MySQL’

Reversible AES Encryption in MySQL

August 13th, 2009 2 comments

Keeping sensitive information for any organization is a must in this day and age, and encrypting this data is one of your many lines of defense. Below are simple one liners on how to use AES encryption and decryption using MySQL as your database. When you call the AES_ENCRYPT function, MySQL will automatically return the encrypted value in a binary form, I’ll show you how to convert this into a hexadecimal value which you will need to do if you ever backup your database to SQL files. I was so happy to find that MySQL had this function built in, I can’t tell you how many types I ran through the PHP api looking for something that could meet my needs, I never even bothered to do a search for it on MySQL.

Note: Do not encrypt passwords!
Yeah, you read that correctly. Not everything needs to be decrypted. Imagine if you had a rouge system administrator, dba, or even worse, a hacker. Passwords need to be and should be hashed. Think about it for a minute, the only reason you would want to encrypt a password is if you want to be able to decrypt it at a later time. There’s no reason to do that, if a user forgets his or her password, it should be reset, and then they should be forced to change it on their next login. Read more…

Categories: Tutorials Tags:

Generate MD5 and SHA1 Password Hash

August 9th, 2009 No comments

It’s really simple to generate a MD5 and SHA1 hash using PHP, it’s so simple that I even considered not posting this blog. But then I found myself Googling a website to generate a MD5 hash while I was at work. So I created a simple form for you to create your own MD5 and SHA1 hash. Read more…

Categories: PHP Tags: , ,