__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
/**
* This file contains a modHash implementation of RSA PDKDF2.
* @package modx
* @subpackage hashing
*/
/**
* A PBKDF2 implementation of modHash.
*
* {@inheritdoc}
*
* @package modx
* @subpackage hashing
*/
class modPBKDF2 extends modHash {
/**
* Generate a hash of a string using the RSA PBKDFA2 specification.
*
* The following options are available:
* - salt (required): a valid, non-empty string to salt the hashes
* - iterations: the number of iterations per block, default is 1000 (< 1000 not recommended)
* - derived_key_length: the size of the derived key to generate, default is 32
* - algorithm: the hash algorithm to use, default is sha256
* - raw_output: if true, returns binary output, otherwise derived key is base64_encode()'d; default is false
*
* @param string $string A string to generate a secure hash from.
* @param array $options An array of options to be passed to the hash implementation.
* @return mixed The hash result or false on failure.
*/
public function hash($string, array $options = array()) {
$derivedKey = false;
$salt = $this->getOption('salt', $options, false);
if (is_string($salt) && strlen($salt) > 0) {
$iterations = (integer) $this->getOption('iterations', $options, 1000);
$derivedKeyLength = (integer) $this->getOption('derived_key_length', $options, 32);
$algorithm = $this->getOption('algorithm', $options, 'sha256');
$hashLength = strlen(hash($algorithm, null, true));
$keyBlocks = ceil($derivedKeyLength / $hashLength);
$derivedKey = '';
for ($block = 1; $block <= $keyBlocks; $block++) {
$hashBlock = $hb = hash_hmac($algorithm, $salt . pack('N', $block), $string, true);
for ($blockIteration = 1; $blockIteration < $iterations; $blockIteration++) {
$hashBlock ^= ($hb = hash_hmac($algorithm, $hb, $string, true));
}
$derivedKey .= $hashBlock;
}
$derivedKey = substr($derivedKey, 0, $derivedKeyLength);
if (!$this->getOption('raw_output', $options, false)) {
$derivedKey = base64_encode($derivedKey);
}
} else {
$this->host->modx->log(modX::LOG_LEVEL_ERROR, "PBKDF2 requires a valid salt string.", '', __METHOD__, __FILE__, __LINE__);
}
return $derivedKey;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| images | Folder | 0755 |
|
|
| php53 | Folder | 0755 |
|
|
| php56 | Folder | 0755 |
|
|
| php71 | Folder | 0755 |
|
|
| php81 | Folder | 0755 |
|
|
| php82 | Folder | 0755 |
|
|
| changelog.txt | File | 8.75 KB | 0644 |
|
| clone.php | File | 8.03 KB | 0644 |
|
| config.core.php | File | 287 B | 0644 |
|
| config.inc.php | File | 3.14 KB | 0644 |
|
| edit.php | File | 5.37 KB | 0644 |
|
| edit.xml | File | 433 B | 0644 |
|
| extend.php | File | 11.66 KB | 0644 |
|
| fileindex.php | File | 72 B | 0644 |
|
| import.php | File | 3.85 KB | 0644 |
|
| info.xml | File | 3.78 KB | 0644 |
|
| install.js | File | 921 B | 0644 |
|
| install.php | File | 6.45 KB | 0644 |
|
| install.xml | File | 1.05 KB | 0644 |
|
| md5 | File | 3.22 KB | 0644 |
|
| modhashing.class.php | File | 6.16 KB | 0644 |
|
| modpbkdf2.class.php | File | 2.45 KB | 0644 |
|
| notes.txt | File | 1.52 KB | 0644 |
|
| update_pass.php | File | 672 B | 0644 |
|
| upgrade.php | File | 4 KB | 0644 |
|
| upgrade.xml | File | 436 B | 0644 |
|
| xpdo.class.php | File | 129.25 KB | 0644 |
|