PHP 8.2.29
Preview: class-phpass.php Size: 6.61 KB
/home/medyaist/hurdamakara.com/wp-includes/class-phpass.php
<?php
/**
 * Portable PHP password hashing framework.
 * @package phpass
 * @since 2.5.0
 * @version 0.5 / WordPress
 * @link https://www.openwall.com/phpass/
 */

#
# Portable PHP password hashing framework.
#
# Version 0.5.4 / WordPress.
#
# Written by Solar Designer <solar at openwall.com> in 2004-2006 and placed in
# the public domain.  Revised in subsequent years, still public domain.
#
# There's absolutely no warranty.
#
# The homepage URL for this framework is:
#
#	http://www.openwall.com/phpass/
#
# Please be sure to update the Version line if you edit this file in any way.
# It is suggested that you leave the main version number intact, but indicate
# your project name (after the slash) and add your own revision information.
#
# Please do not change the "private" password hashing method implemented in
# here, thereby making your hashes incompatible.  However, if you must, please
# change the hash type identifier (the "$P$") to something different.
#
# Obviously, since this code is in the public domain, the above are not
# requirements (there can be none), but merely suggestions.
#

/**
 * Portable PHP password hashing framework.
 *
 * @package phpass
 * @version 0.5 / WordPress
 * @link https://www.openwall.com/phpass/
 * @since 2.5.0
 */
class PasswordHash {
	var $itoa64;
	var $iteration_count_log2;
	var $portable_hashes;
	var $random_state;

	function __construct($iteration_count_log2, $portable_hashes)
	{
		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

		if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) {
			$iteration_count_log2 = 8;
		}
		$this->iteration_count_log2 = $iteration_count_log2;

		$this->portable_hashes = $portable_hashes;

		$this->random_state = microtime();
		if (function_exists('getmypid')) {
			$this->random_state .= getmypid();
		}
	}

	function PasswordHash($iteration_count_log2, $portable_hashes)
	{
		self::__construct($iteration_count_log2, $portable_hashes);
	}

	function get_random_bytes($count)
	{
		$output = '';
		if (@is_readable('/dev/urandom') &&
		    ($fh = @fopen('/dev/urandom', 'rb'))) {
			$output = fread($fh, $count);
			fclose($fh);
		}

		if (strlen($output) < $count) {
			$output = '';
			for ($i = 0; $i < $count; $i += 16) {
				$this->random_state =
				    md5(microtime() . $this->random_state);
				$output .= md5($this->random_state, TRUE);
			}
			$output = substr($output, 0, $count);
		}

		return $output;
	}

	function encode64($input, $count)
	{
		$output = '';
		$i = 0;
		do {
			$value = ord($input[$i++]);
			$output .= $this->itoa64[$value & 0x3f];
			if ($i < $count) {
				$value |= ord($input[$i]) << 8;
			}
			$output .= $this->itoa64[($value >> 6) & 0x3f];
			if ($i++ >= $count) {
				break;
			}
			if ($i < $count) {
				$value |= ord($input[$i]) << 16;
			}
			$output .= $this->itoa64[($value >> 12) & 0x3f];
			if ($i++ >= $count) {
				break;
			}
			$output .= $this->itoa64[($value >> 18) & 0x3f];
		} while ($i < $count);

		return $output;
	}

	function gensalt_private($input)
	{
		$output = '$P$';
		$output .= $this->itoa64[min($this->iteration_count_log2 + 5,
		    30)];
		$output .= $this->encode64($input, 6);

		return $output;
	}

	function crypt_private($password, $setting)
	{
		$output = '*0';
		if (substr($setting, 0, 2) === $output) {
			$output = '*1';
		}

		$id = substr($setting, 0, 3);
		# We use "$P$", phpBB3 uses "$H$" for the same thing
		if ($id !== '$P$' && $id !== '$H$') {
			return $output;
		}

		$count_log2 = strpos($this->itoa64, $setting[3]);
		if ($count_log2 < 7 || $count_log2 > 30) {
			return $output;
		}

		$count = 1 << $count_log2;

		$salt = substr($setting, 4, 8);
		if (strlen($salt) !== 8) {
			return $output;
		}

		# We were kind of forced to use MD5 here since it's the only
		# cryptographic primitive that was available in all versions
		# of PHP in use.  To implement our own low-level crypto in PHP
		# would have resulted in much worse performance and
		# consequently in lower iteration counts and hashes that are
		# quicker to crack (by non-PHP code).
		$hash = md5($salt . $password, TRUE);
		do {
			$hash = md5($hash . $password, TRUE);
		} while (--$count);

		$output = substr($setting, 0, 12);
		$output .= $this->encode64($hash, 16);

		return $output;
	}

	function gensalt_blowfish($input)
	{
		# This one needs to use a different order of characters and a
		# different encoding scheme from the one in encode64() above.
		# We care because the last character in our encoded string will
		# only represent 2 bits.  While two known implementations of
		# bcrypt will happily accept and correct a salt string which
		# has the 4 unused bits set to non-zero, we do not want to take
		# chances and we also do not want to waste an additional byte
		# of entropy.
		$itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

		$output = '$2a$';
		$output .= chr((int)(ord('0') + $this->iteration_count_log2 / 10));
		$output .= chr(ord('0') + $this->iteration_count_log2 % 10);
		$output .= '$';

		$i = 0;
		do {
			$c1 = ord($input[$i++]);
			$output .= $itoa64[$c1 >> 2];
			$c1 = ($c1 & 0x03) << 4;
			if ($i >= 16) {
				$output .= $itoa64[$c1];
				break;
			}

			$c2 = ord($input[$i++]);
			$c1 |= $c2 >> 4;
			$output .= $itoa64[$c1];
			$c1 = ($c2 & 0x0f) << 2;

			$c2 = ord($input[$i++]);
			$c1 |= $c2 >> 6;
			$output .= $itoa64[$c1];
			$output .= $itoa64[$c2 & 0x3f];
		} while (1);

		return $output;
	}

	function HashPassword($password)
	{
		if ( strlen( $password ) > 4096 ) {
			return '*';
		}

		$random = '';

		if (CRYPT_BLOWFISH === 1 && !$this->portable_hashes) {
			$random = $this->get_random_bytes(16);
			$hash =
			    crypt($password, $this->gensalt_blowfish($random));
			if (strlen($hash) === 60) {
				return $hash;
			}
		}

		if (strlen($random) < 6) {
			$random = $this->get_random_bytes(6);
		}
		$hash =
		    $this->crypt_private($password,
		    $this->gensalt_private($random));
		if (strlen($hash) === 34) {
			return $hash;
		}

		# Returning '*' on error is safe here, but would _not_ be safe
		# in a crypt(3)-like function used _both_ for generating new
		# hashes and for validating passwords against existing hashes.
		return '*';
	}

	function CheckPassword($password, $stored_hash)
	{
		if ( strlen( $password ) > 4096 ) {
			return false;
		}

		$hash = $this->crypt_private($password, $stored_hash);
		if ($hash[0] === '*') {
			$hash = crypt($password, $stored_hash);
		}

		# This is not constant-time.  In order to keep the code simple,
		# for timing safety we currently rely on the salts being
		# unpredictable, which they are at least in the non-fallback
		# cases (that is, when we use /dev/urandom and bcrypt).
		return $hash === $stored_hash;
	}
}

Directory Contents

Dirs: 29 × Files: 157
Name Size Perms Modified Actions
- drwxr-xr-x 2025-12-08 20:16:39
Edit Download
assets DIR
- drwxr-xr-x 2026-01-12 19:14:21
Edit Download
- drwxr-xr-x 2026-01-13 23:39:06
Edit Download
- drwxr-xr-x 2026-01-12 17:08:40
Edit Download
- drwxr-xr-x 2026-01-13 23:39:44
Edit Download
blocks DIR
- drwxr-xr-x 2025-12-08 20:16:39
Edit Download
- drwxr-xr-x 2026-01-10 00:00:44
Edit Download
css DIR
- drwxr-xr-x 2025-12-08 20:16:40
Edit Download
customize DIR
- drwxr-xr-x 2026-01-11 16:24:47
Edit Download
fonts DIR
- drwxr-xr-x 2026-01-10 01:21:47
Edit Download
html-api DIR
- drwxr-xr-x 2026-01-13 22:17:35
Edit Download
ID3 DIR
- drwxr-xr-x 2026-01-12 18:31:02
Edit Download
images DIR
- drwxr-xr-x 2026-01-12 15:04:48
Edit Download
- drwxr-xr-x 2026-01-13 22:18:06
Edit Download
IXR DIR
- drwxr-xr-x 2026-01-10 11:25:41
Edit Download
js DIR
- drwxr-xr-x 2026-01-13 23:31:25
Edit Download
l10n DIR
- drwxr-xr-x 2026-01-14 08:18:01
Edit Download
- drwxr-xr-x 2026-01-12 08:39:48
Edit Download
PHPMailer DIR
- drwxr-xr-x 2026-01-13 23:43:59
Edit Download
pomo DIR
- drwxr-xr-x 2026-01-13 22:19:44
Edit Download
Requests DIR
- drwxr-xr-x 2025-12-08 04:57:55
Edit Download
rest-api DIR
- drwxr-xr-x 2026-01-13 22:19:52
Edit Download
SimplePie DIR
- drwxr-xr-x 2025-12-08 20:16:49
Edit Download
sitemaps DIR
- drwxr-xr-x 2025-12-08 04:57:59
Edit Download
- drwxr-xr-x 2026-01-12 11:12:21
Edit Download
- drwxr-xr-x 2025-12-08 04:57:12
Edit Download
Text DIR
- drwxr-xr-x 2025-12-08 20:16:39
Edit Download
- drwxr-xr-x 2026-01-14 08:18:41
Edit Download
widgets DIR
- drwxr-xr-x 2026-01-10 05:05:07
Edit Download
7.80 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
18.94 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
7.35 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
12.90 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
61.02 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
112.05 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
42.63 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
55.71 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
28.92 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.61 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.18 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
17.46 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
5.14 KB lrw-r--r-- 2025-12-08 04:56:47
Edit Download
16.70 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
8.28 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
2.92 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
1.32 KB lrw-r--r-- 2025-12-08 04:56:47
Edit Download
4.60 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
11.62 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
2.50 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
1.97 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
11.25 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
5.32 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
10.60 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
67.84 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.34 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
5.49 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
1.99 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.02 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.91 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
16.86 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
24.23 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
3.97 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
47.66 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
9.22 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
25.51 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
198.38 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
56.65 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
10.46 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
10.95 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
29.26 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
70.91 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
35.30 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
15.02 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.57 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
39.83 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
70.64 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
15.56 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
7.33 KB lrw-r--r-- 2025-12-08 04:56:48
Edit Download
253 B lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.96 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
3.23 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
969 B lrw-r--r-- 2025-12-08 20:16:46
Edit Download
16.28 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.22 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
12.95 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.53 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
5.84 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
1.97 KB lrw-r--r-- 2025-12-08 04:56:48
Edit Download
4.30 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.91 KB lrw-r--r-- 2025-12-08 04:56:48
Edit Download
16.46 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
40.60 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
20.22 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
36.11 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
17.01 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.27 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.62 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
16.49 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
1.79 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
29.82 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.67 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
8.98 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
19.42 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
12.01 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
17.11 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.74 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
30.93 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.99 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.25 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
24.72 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.34 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
159.91 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.72 KB lrw-r--r-- 2025-12-08 04:56:49
Edit Download
10.92 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.77 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
3.38 KB lrw-r--r-- 2025-12-08 04:56:49
Edit Download
11.18 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
62.19 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.46 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
9.17 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
31.13 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
33.38 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.15 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
3.47 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
1.87 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
30.91 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.29 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
7.35 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
11.86 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
19.12 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
18.12 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
39.99 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
5.17 KB lrw-r--r-- 2025-12-08 04:56:50
Edit Download
979 B lrw-r--r-- 2025-12-08 20:16:45
Edit Download
18.44 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
10.24 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
1.77 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
34.90 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
7.19 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
160.50 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
64.27 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
27.95 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
4.69 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
2.94 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
13.01 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
3.27 KB lrw-r--r-- 2025-12-08 04:56:50
Edit Download
18.00 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
210.40 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
25.86 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
373 B lrw-r--r-- 2025-12-08 04:56:51
Edit Download
343 B lrw-r--r-- 2025-12-08 04:56:51
Edit Download
338 B lrw-r--r-- 2025-12-08 04:56:51
Edit Download
100.73 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
11.10 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
37.02 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.24 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.02 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
226.02 KB lrw-r--r-- 2026-03-02 06:09:08
Edit Download
5.38 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
1.16 KB lrw-r--r-- 2025-12-08 04:56:51
Edit Download
4.04 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
9.56 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
281.84 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
14.95 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
8.44 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
20.71 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
5.72 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
81.72 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
25.24 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
4.81 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.48 KB lrw-r--r-- 2025-12-08 04:56:52
Edit Download
2.79 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
89.69 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
4.11 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
6.94 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
200 B lrw-r--r-- 2025-12-08 04:56:53
Edit Download
255 B lrw-r--r-- 2025-12-08 04:56:53
Edit Download
22.66 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
9.68 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
544 B lrw-r--r-- 2025-12-08 20:16:45
Edit Download
2.84 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.09 KB lrw-r--r-- 2025-12-08 20:16:46
Edit Download
6.41 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
69.46 KB lrw-r--r-- 2025-12-08 20:16:45
Edit Download
445 B lrw-r--r-- 2025-12-08 04:56:54
Edit Download
799 B lrw-r--r-- 2025-12-08 20:16:45
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).