PluginProbe
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses / 1.0.91
FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses v1.0.91
2.10.0 2.10.01 2.9.1 2.9.0 2.8.1 2.8.0 2.7.7 2.7.5 2.7.0 2.6.01 2.6.0 2.5.0 2.4.01 trunk 1.0.90 1.0.91 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.0.97 1.0.98 1.0.99 1.1.0 All 77 releases
fluent-community / vendor / wpfluent / framework / src / WPFluent / Support / Hash.php

Hash.php in FluentCommunity – Ultra-Fast High-Performance Social Network, Community, LMS & Online Courses 1.0.91, at vendor/wpfluent/framework/src/WPFluent/Support/Hash.php

60 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCommunity\Framework\Support;
4
5 class Hash
6 {
7 /**
8 * $algo Hashing algorithm
9 * @var int
10 */
11 protected static $algo = PASSWORD_BCRYPT;
12
13 /**
14 * Hash a value using the default algorithm.
15 *
16 * @param string $value
17 * @return string
18 */
19 public static function make($value)
20 {
21 return password_hash($value, static::$algo);
22 }
23
24 /**
25 * Check if the given value is already hashed.
26 *
27 * @param string $value
28 * @return bool
29 */
30 public static function isHashed($value)
31 {
32 return is_string($value) &&
33 strlen($value) === 60 &&
34 strpos($value, '$') === 0;
35 }
36
37 /**
38 * Verify the hashed value's configuration.
39 *
40 * @param string $hash
41 * @return bool
42 */
43 public static function verifyConfiguration($hash)
44 {
45 return password_needs_rehash($hash, static::$algo) === false;
46 }
47
48 /**
49 * Verify if the given plain value matches the hash.
50 *
51 * @param string $value
52 * @param string $hash
53 * @return bool
54 */
55 public static function check($value, $hash)
56 {
57 return password_verify($value, $hash);
58 }
59 }
60