0

Is mysql5 algoritm is SHA-1(SHA-1($pass)) ?

Then i trying this http://vb.wikia.com/wiki/SHA-1.bas script, with function =SHA1HASH(SHA1HASH("test")) i get c4033bff94b567a190e33faa551f411caef444f2 but Mysql5 hash must be 94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29

How to convert string to Mysql5 hash in VBA?

enter image description here

I have found why this hapens,

because Sha1 provided in Hex, but Mysql5 in binary

6
  • Are you sure $pass = "test"? SELECT SHA1(SHA1('test')) = c4033bff94b567a190e33faa551f411caef444f2 Commented Feb 23, 2013 at 10:06
  • Yes i am sure i.sstatic.net/rnpfI.png Commented Feb 23, 2013 at 10:18
  • what did you use to calculate the following hash: 94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 Commented Feb 23, 2013 at 10:19
  • To generate the hash provided, try in mysql SELECT PASSWORD("test"), If you need to use the password hashing outside of mysql - I would recommend that you use sha1 - with salting. dev.mysql.com/doc/refman/5.0/en/… Commented Feb 23, 2013 at 10:24
  • I need Excel VBA. I use insidepro.com/hashes.php?lang=eng to calculate the following hash: 94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 Commented Feb 23, 2013 at 10:25

1 Answer 1

1

It looks like the string 94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 was generated via the MySQL function PASSWORD().

SELECT PASSWORD("test") /* *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 */

As recommended by the MySQL documentation if you need to maintain all you hash code in excel you need to change your original hashing process to use something like SHA1.

From the MySQL documentation: http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html#function_password The PASSWORD() function is used by the authentication system in MySQL Server; you should not use it in your own applications. For that purpose, consider MD5() or SHA1() instead.

Sign up to request clarification or add additional context in comments.

3 Comments

I do not want change anything, i want get *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 from string test in EXCEL VBA
Why do you want to get that particular hash - it is a proprietary hashing method used by MySQL 5 to generate internal hashes for MySQL. There own documentation recommends that you do not use it. Unless you have already gone down a irreversible route I highly recommend you switch to a non-proprietary option. If you NEED to use the MySQL PASSWORD() function, you will need to install connect to either a local or remote MySQL server from your VBA module, run the following SQL SELECT PASSWORD("test") and get the result.
i have already generated passwords in Mysql5 hashes from passwords, i just want to compare if password has been changed

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.