Skip to content

Instantly share code, notes, and snippets.

@steve-todorov
Created May 26, 2014 05:40
Show Gist options
  • Save steve-todorov/945c28c259e295d008a4 to your computer and use it in GitHub Desktop.
Save steve-todorov/945c28c259e295d008a4 to your computer and use it in GitHub Desktop.
Create valid SSHA passwords for OpenLDAP
<?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