How to generate a joomla user password using c#?
there is a question about php code to geneate joomla pass: using php to 开发者_StackOverflowcreate a joomla user password? , any ideas how to do it on a c#?
Theres some useful code here: http://www.marinovanderheijden.nl/post/2011/02/10/Validating-Joomla-15-passwords-with-C.aspx
Your best bet would be to port the code Joomla uses into your own libraries as static methods. All you have to do in the end would be to take the PHP process:
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword(password, $salt);
$dbPassword = $crypt.':'.$salt;
and convert it to C#:
string salt = Libraries.JUserHelper.genRandomPassword(32);
string crypt = Libraries.JUserHelper.getCryptedPassword(password, salt);
string dbPassword = string.Format("{0}:{1}", crypt, salt);
精彩评论