douping3891 2015-08-20 09:46
浏览 46
已采纳

外部认证IPB论坛

I coded an external authentication in PHP and it works for 99% of all users. However the authentication doesn't work for the other 1% which is quite a lot in absolute numbers. I already wrote IPB but they are not able to help me.

I located that the reason is the way I try to rebuild the md5 hash. Please again note that I am using the exact same way as recommended by IPB ( https://www.invisionpower.com/support/guides/_/advanced-and-developers/miscellaneous/passwords-in-ipboard-r130 ). The following code example shows an example where the created md5 DIFFERS from the md5 in the database. The normal login at forum works with this password though.

<?php
    $md5 = 'e69618bbe9850fbaf633014f84b8f040';
    $salt = '}i3#W';
    $plainpass = 'Wv&Txq,LYD-su_6';

    $saltedPassword = md5( md5($salt) . md5($plainpass) );
    echo "Desired result: $md5 , actual result: $saltedPassword";
?>

How can I reach my desired md5? I guess it has something to do with the user's password or user's salt. Thus it is working for 99% of all users, but not for this example and other users.

  • 写回答

1条回答 默认 最新

  • dqh1984 2017-11-29 16:16
    关注

    With the IPB4 release they update all old passwords to blowfish encryption. However this only happens once the user logs into the forum suite. Until then the old password encryption will remain. So in fact you have to check if it's a md5 salted password or if the password is encrypted with blowfish (see below).

    As of IPB4 release the password encryption changed from salted MD5 to Blowfish:

    /* $password is the raw password and $salt is the salt returned from fetchSalt */
    crypt( $password, '$2a$13$' . $salt );
    

    $2a$13$ refers to the salt prefix and a pre-determined cost factor that should not be altered.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?