Skip navigation links

MySQL Forums


Advanced Search

Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql?
Posted by: Roland Bouman ()
Date: April 11, 2006 01:07PM

The @strMemberPwd is a parameter or local variable in a proc right?

assuming a local variable (http://dev.mysql.com/doc/refman/5.0/en/variables-in-stored-procedures.html) or procedure parameter (http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html), it would become just strMemberPwd
The @ denotes a user variable in mysql (http://dev.mysql.com/doc/refman/5.0/en/example-user-variables.html), something you should avoid unless you have something very specific in mind (see: http://forums.mysql.com/read.php?98,62373,62512#msg-62512 and/or http://forums.mysql.com/read.php?98,75266,75509#msg-75509 )

as for the translation:

convert => cast or convert, see: http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

in this context: varbinary(50) => binary(50), see again http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html

pwdencrypt => I never heard of this, but good as ever google told me this: http://www.theregister.co.uk/2002/07/08/cracking_ms_sql_server_passwords/
I will leave that as it is, I'm just assuming you want to hash a password, right? Well, if I'm right, take your pick from here: http://dev.mysql.com/doc/refman/5.0/en/application-password-use.html or here: http://dev.mysql.com/doc/refman/5.0/en/encryption-functions.html

I will assume sha1 for pwdencrypt...

Putting it together:

cast(binary(50), sha1(strMemberPwd))

hope it helps. Maybe it's a good idea to actually follow some of the links and make the right decisions yourself. I doubt that blindly pluggin this code is as good as it should be for your purpose....

kind regards, ROland

Options: ReplyQuote


Subject Written By Posted
How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Even Cheng 04/10/2006 10:28PM
Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Roland Bouman 04/11/2006 01:07PM
Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Even Cheng 04/11/2006 08:22PM
Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Roland Bouman 04/12/2006 01:57AM
Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Roland Bouman 04/12/2006 12:21PM
Re: How to convert "Convert(varbinary(50),pwdencrypt(@strMemberPwd))" to MySql? Even Cheng 04/16/2006 10:00PM


Sorry, you can't reply to this topic. It has been closed.