I am trying to figure out how to create the best secure password for AES_ENCRYPT. Specifically, how long should the password be, and how it translates into the 128 bit key length that AES typically uses.
2 Answers
This really isn't a mysql question, more of a "how does encryption work" question. If you have some time to kill you might want to watch this series
http://www.youtube.com/watch?v=dlS5_qfxAss&feature=results_main&playnext=1&list=PLDCC9179604F435AB
Here's what I felt was a good explaination of password strength I came across a while back
Remember though, the theoretical security of your password is moot if it's stored in source code that is not secure (world readable, ending up in a .mysql_history when working from the commandline, etc).
-
Actually, it is not "how does encryption work". Unless I am mistaken, AES encryption would encrypt with a 128 bit (16 byte) key. My question was, how is it that MySQL (and perhaps other databases) convert the password to the 128bit key. Commented Sep 20, 2011 at 12:44
-
This question can be tagged a MySQL question. In fact, there is an AES_ENCRYPT function (dev.mysql.com/doc/refman/5.1/en/…) in the MySQL Documentation. There is also AES_DECRYPT. Commented Sep 21, 2011 at 20:14
It seems someone else has already found the answer on security.stackexchange.com
Sorry but I found that later from RubyForum
"The algorithm just creates a 16 byte buffer set to all zero, then loops through all the characters of the string you provide and does an assignment with bitwise OR between the two values. If we iterate until we hit the end of the 16 byte buffer, we just start over from the beginning doing ^=. For strings shorter than 16 characters, we stop at the end of the string."
AES_ENCRYPT
to encrypt and then store account or user passwords?