开发者

How to generate a joomla user password using c#?

开发者 https://www.devze.com 2023-02-17 08:23 出处:网络
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.mar

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消