Created
May 26, 2014 05:40
-
-
Save steve-todorov/945c28c259e295d008a4 to your computer and use it in GitHub Desktop.
Create valid SSHA passwords for OpenLDAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ssha_password($password){ | |
$salt = substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',4)),0,4); | |
return '{SSHA}' . base64_encode(sha1( $password.$salt, TRUE ). $salt); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment