previousFile_Passwd_Unix::isShadowed (Previous) (Next) File_Passwd_Cvsnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

File_Passwd_Unix::generatePassword

File_Passwd_Unix::generatePassword() – Generate password

Synopsis

mixed File_Passwd_Unix::generatePassword ( string $pass , string $mode = 'md5' , string $salt = null )

Description

Generate a "Un*x" style password.

The encryption mode can be of any type File_Passwd provides, although FILE_PASSWD_MD5 and FILE_PASSWD_DES are the most common.

Parameter

string $pass

the plaintext password to encrypt

string $mode

the encryption mode to use

string $salt

the salt to use for encryption (usually empty)

Return value

Returns string encrypted password, or PEAR_Error FILE_PASSWD_E_INVALID_ENC_MODE if encryption mode is not supported.

Example

File_Passwd_Unix::generatePassword()

<?php
require_once 'File/Passwd/Unix.php';
$pass File_Passwd_Unix::generatePassword('secret'FILE_PASSWD_MD5);
?>

Note

This function should be called statically.

previousFile_Passwd_Unix::isShadowed (Previous) (Next) File_Passwd_Cvsnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.