|
const | BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' |
|
const | APRMD5_ALPHABET = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' |
|
Definition at line 5 of file APR1_MD5.php.
◆ check()
static WhiteHat101\Crypt\APR1_MD5::check |
( |
|
$plain, |
|
|
|
$hash |
|
) |
| |
|
static |
Definition at line 63 of file APR1_MD5.php.
References GuzzleHttp\Psr7\hash().
64 $parts = explode(
'$', $hash);
65 return self::hash($plain, $parts[2]) === $hash;
hash(StreamInterface $stream, $algo, $rawOutput=false)
Calculate a hash of a Stream.
◆ hash()
static WhiteHat101\Crypt\APR1_MD5::hash |
( |
|
$mdp, |
|
|
|
$salt = null |
|
) |
| |
|
static |
Definition at line 17 of file APR1_MD5.php.
References $i, and $new.
20 $salt = substr($salt, 0, 8);
22 $context = $mdp.
'$apr1$'.$salt;
23 $binary = pack(
'H32', md5($mdp.$salt.$mdp));
25 $context .= substr($binary, 0, min(16,
$i));
27 $context .= (
$i & 1) ? chr(0) : $mdp[0];
28 $binary = pack(
'H32', md5($context));
30 $new = (
$i & 1) ? $mdp : $binary;
33 $new .= (
$i & 1) ? $binary : $mdp;
34 $binary = pack(
'H32', md5(
$new));
37 for (
$i = 0;
$i < 5;
$i++) {
41 $hash = $binary[
$i].$binary[$k].$binary[$j].$hash;
43 $hash = chr(0).chr(0).$binary[11].$hash;
45 strrev(substr(base64_encode($hash), 2)),
46 self::BASE64_ALPHABET,
49 return '$apr1$'.$salt.
'$'.$hash;
◆ salt()
static WhiteHat101\Crypt\APR1_MD5::salt |
( |
| ) |
|
|
static |
Definition at line 53 of file APR1_MD5.php.
References $i.
54 $alphabet = self::APRMD5_ALPHABET;
57 $offset = hexdec(bin2hex(openssl_random_pseudo_bytes(1))) % 64;
58 $salt .= $alphabet[$offset];
◆ APRMD5_ALPHABET
const WhiteHat101\Crypt\APR1_MD5::APRMD5_ALPHABET = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' |
◆ BASE64_ALPHABET
const WhiteHat101\Crypt\APR1_MD5::BASE64_ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' |
The documentation for this class was generated from the following file: