Support » Plugin: External Login » Custom hash for password

  • Resolved KZKG^Gaara

    (@kzkggaara)


    Hi,
    First of all … GREAT PLUGIN !!
    Thanks, its really a excellent work !

    Happens that my password hash its not one of the list (md5, sha1, bcrypt, etc), its:
    Assuming… :

    $user = "username"
    $password = "thisismypass"
    $hash = sha1(strtoupper($user.":".$password));

    I mean… combining $user and : and $password … all that in upper case AND THEN … sha1

    And then the result that is saved in db is: 4BEA0019DDEB65D9CABDA4C218AADC1C33828267

    So, what can I do ?

    Where can I change/add this custom hash gen ?

    Thanks for all

    • This topic was modified 2 months ago by KZKG^Gaara.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author tbenyon

    (@tbenyon)

    Hey @kzkggaara,

    This is very possible for the plugin. For users that have a custom hashing algorithm you can validate the password in your own way.

    If you look on the FAQ section on the main page there is a part about custom hooks.

    In there I document how to use a custom hash by using the exlog_hook_filter_authenticate_hash filter.

    In your case, adding the following block of code to your functions.php file should solve the problem for you…

    
    function myExlogHashAuthenticator($password, $hashFromDatabase, $username, $externalUserData) {
        $generatedHash = sha1(strtoupper($username.":".$password));
        return $hashFromDatabase == $generatedHash;
    }
    add_filter('exlog_hook_filter_authenticate_hash', 'myExlogHashAuthenticator', 10, 4);
    

    I haven’t tested this, it is just pseudocode but it should give you the basis of what you need.

    Do come back and tell me how you got on 🙂

    Plugin Author tbenyon

    (@tbenyon)

    Hey @kzkggaara,

    Just checking in to see how you got on and if this is resolved for you 🙂

    Plugin Author tbenyon

    (@tbenyon)

    Marking as resolved as I’ve not heard back. Feel free to get back in contact here if you have any further questions 🙂

    Thanks,

    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.