Overview

Namespaces

  • PHP
  • PHPassLib
    • Application
    • Exception
    • Hash
    • Test
      • Application
      • Hash

Classes

  • BCrypt
  • BSDiCrypt
  • DESCrypt
  • MD5Crypt
  • PBKDF2
  • Portable
  • SHA1Crypt
  • SHA256Crypt
  • SHA512Crypt
  • Overview
  • Namespace
  • Class
  • Tree

Class DESCrypt

DES Crypt Module

The DES Crypt algorithm is the original DES-based Unix crypt algorithm. It is an old algorithm which should be avoided for new applications.

Supported parameters:

  • salt: Optional salt string. If provided, it must be a 2 character string containing only characters in the regex range [./0-9A-Za-z]. It is highly recommended that this parameter be left blank, in which case the library will generate a suitable salt for you.

This module uses PHP's native crypt() function, which has had native support for DES Crypt since 5.3.0.

PHPassLib\Hash\DESCrypt implements PHPassLib\Hash
Namespace: PHPassLib\Hash
Package: PHPassLib\Hashes
Copyright: Copyright (c) 2012, Ryan Chouinard
License: License - http://www.opensource.org/licenses/mit-license.php
Author: Ryan Chouinard <rchouinard@gmail.com>
Located at src/PHPassLib/Hash/DESCrypt.php
Methods summary
public static string
# genConfig( array $config = array () )

Generate a config string from an array.

Generate a config string from an array.

Parameters

$config
array
$config Array of configuration options.

Returns

string
Configuration string.

Throws

PHPassLib\Exception\InvalidArgumentException
Throws an InvalidArgumentException if any passed-in configuration options are invalid.

Implementation of

PHPassLib\Hash::genConfig()
public static array
# parseConfig( string $config )

Parse a config string into an array.

Parse a config string into an array.

Parameters

$config
string
$config Configuration string.

Returns

array
Array of configuration options or false on failure.

Implementation of

PHPassLib\Hash::parseConfig()
public static string
# genHash( string $password, string $config )

Generate a password hash using a config string.

Generate a password hash using a config string.

Parameters

$password
string
$password Password string.
$config
string
$config Configuration string.

Returns

string
Returns the hash string on success. On failure, one of *0 or *1 is returned.

Implementation of

PHPassLib\Hash::genHash()
public static string
# hash( string $password, string|array $config = array () )

Generate a password hash using a config string or array.

Generate a password hash using a config string or array.

Parameters

$password
string
$password Password string.
$config
string|array
$config Optional config string or array of options.

Returns

string
Returns the hash string on success. On failure, one of *0 or *1 is returned.

Throws

PHPassLib\Exception\InvalidArgumentException
Throws an InvalidArgumentException if any passed-in configuration options are invalid.

Implementation of

PHPassLib\Hash::hash()
public static boolean
# verify( string $password, string $hash )

Verify a password against a hash string.

Verify a password against a hash string.

Parameters

$password
string
$password Password string.
$hash
string
$hash Hash string.

Returns

boolean
Returns true if the password matches, false otherwise.

Implementation of

PHPassLib\Hash::verify()
protected static boolean
# validateOptions( array $options )

Parameters

$options
array
$options

Returns

boolean

Throws

PHPassLib\Exception\InvalidArgumentException
PHP Password Library API documentation generated by ApiGen 2.8.0