File_Passwd_Authbasic::generatePassword

File_Passwd_Authbasic::generatePassword() – Generate password

Synopsis

mixed File_Passwd_Authbasic::generatePassword ( string $pass , string $mode = 'des' , string $salt = null )

Description

Generate a password usable for "AuthBasic" authentication.

The encryption mode can either be FILE_PASSWD_DES, FILE_PASSWD_SHA or FILE_PASSWD_MD5.

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_Authbasic::generatePassword()

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

Note

This function should be called statically.

Get supported encryption modes (Previous) File_Passwd_Authdigest (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.