Re: [389-users] SSHA and friends

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Gerrad,

I use php in my self written usermanagement webapp.

Here a code snippet (part of a utility class) which works for me:

protected function generateSSHAHash($plaintext) {
        mt_srand((double)microtime()*1000000);
              
        $salt = $this->myhash_keygen_s2k(
                                    $plaintext,
                                    substr(pack('h*', md5(mt_rand())), 
0, 8),
                                    4 );
        $hash = "{SSHA}".base64_encode(hash('sha1', $plaintext.$salt, 
TRUE).$salt);

        return $hash;    
 }

protected function myhash_keygen_s2k($pass, $salt, $bytes ){
      return substr(pack("h*", sha1($salt . $pass)), 0, $bytes);
}

Cheers, Rudolf

Gerrard Geldenhuis wrote:
>
> Hi
>
> This is probably OT but I am not having much luck with google. How can 
> I create SSHA512 strings? I have been using either a php script or 
> slappasswd to create SSHA password but not sure how to do SSHA512. 
> openssl can create the SHA512 digest but I am not sure how to add the 
> random seed bit. My question probably illuminate my lack of 
> understanding of the subject.
>
>  
>
> Best Regards
>
>
> ________________________________________________________________________
> In order to protect our email recipients, Betfair Group use SkyScan from
> MessageLabs to scan all Incoming and Outgoing mail for viruses.
>
> ________________________________________________________________________
> ------------------------------------------------------------------------
>
> --
> 389 users mailing list
> 389-users@xxxxxxxxxxxxxxxxxxxxxxx
> https://admin.fedoraproject.org/mailman/listinfo/389-users


-- 
Rudolf Hatheyer
alpha nova Betriebsgesm.b.H.

Idlhofgasse 59-63
8020 Graz
Tel:   0043/316/722622
Fax:   0043/316/722622-16
Mobil: 0699/14032570

http://www.alphanova.at

--
389 users mailing list
389-users@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/389-users


[Index of Archives]     [Fedora Directory Users]     [Fedora Directory Devel]     [Fedora Announce]     [Fedora Legacy Announce]     [Kernel]     [Fedora Legacy]     [Share Photos]     [Fedora Desktop]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Big List of Linux Books]     [Gimp]     [Yosemite News]

  Powered by Linux