ePages 7.48.0 - DE_EPAGES/Core/API/Password.pm

Package DE_EPAGES::Core::API::Password

Provides functionality for creating, hashing and validating user passwords.

@EXPORT_OK
CheckPassword
GenerateNewPassword

Functions

CheckPassword
GenerateNewPassword

CheckPassword

Checks if a password matches with a stored hashed password. The hashing algorithm is automatically detected from the hash, supported are:

Syntax
$Checked = CheckPassword($Password, $StoredPasswordHash);
Example
if (CheckPassword($Password, $StoredPasswordHash)) { print 'check'; };
Input
$Password (string)
plain password
$StoredPasswordHash (string)
stored hash of a password
Return
$Checked (boolean)
determines if the password is correct

GenerateNewPassword

Generates a plain random word containing only alphanumeric characters.

Syntax
$Password = GenerateNewPassword($Length);
Input
$Length (integer)
password length (optional, default 8)
Return
$Password (string)
generated password