1

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
  • Are you planning to use AES_ENCRYPT to encrypt and then store account or user passwords? Commented Sep 20, 2011 at 3:22
  • Well, actually no. Passwords I would store in a one-way encryption with good salt and multiple steps. Other sensitive information requires two-way encryption, I was advised to use AES_ENCRYPT, but I instead plan to AES encrypt before sending to MySQL. But I still have that question,, if AES key length is 128 bits,, how is the password converted to the AES key? Commented Sep 20, 2011 at 12:39

2 Answers 2

1

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

http://www.reddit.com/r/programming/comments/9pu3k/how_long_would_it_take_to_bruteforce_crack_an_aes/c0dv7sx

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).

2
  • 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
1

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."

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.