C:\xampp\htdocs\landing\wp-content\plugins\better-wp-security\core\lib\itsec-zxcvbn-php\matcher.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
class ITSEC_Zxcvbn_Matcher {

    private 
$penalty_strings = array();

    
/**
     * @var array Registered Matchers, Key is class name, value is file to require_once
     */
    
private $matchers;

    public function 
__construct() {
        
$this->matchers = array(
            
'ITSEC_Zxcvbn_Dictionary_Match'         => dirname__FILE__ ) . '/matchers/dictionary.php',
            
'ITSEC_Zxcvbn_Dictionary_Reverse_Match' => dirname__FILE__ ) . '/matchers/dictionary-reverse.php',
            
'ITSEC_Zxcvbn_Dictionary_L33t_Match'    => dirname__FILE__ ) . '/matchers/dictionary-l33t.php',
            
'ITSEC_Zxcvbn_Spatial_Match'            => dirname__FILE__ ) . '/matchers/spatial.php',
            
'ITSEC_Zxcvbn_Repeat_Match'             => dirname__FILE__ ) . '/matchers/repeat.php',
            
'ITSEC_Zxcvbn_Sequence_Match'           => dirname__FILE__ ) . '/matchers/sequence.php',
            
'ITSEC_Zxcvbn_Regex_Match'              => dirname__FILE__ ) . '/matchers/regex.php',
            
'ITSEC_Zxcvbn_Date_Match'               => dirname__FILE__ ) . '/matchers/date.php',
            
'ITSEC_Zxcvbn_Bruteforce_Match'         => dirname__FILE__ ) . '/matchers/bruteforce.php',
        );
        foreach ( 
$this->matchers as $file ) {
            require_once( 
$file );
        }
    }

    public function 
omnimatch$password ) {
        
$matches = array();
        foreach ( 
$this->matchers as $class => $file ) {
            
$matched call_user_func( array( $class'match'), $password$this->penalty_strings );
            if ( ! empty( 
$matched ) && is_array$matched ) ) {
                
$matches array_merge$matches$matched );
            }
        }
        return 
$matches;
    }

    public function 
set_user_input_dictionary$list ) {
        
// @todo process this properly
        
$this->penalty_strings $list;
    }

}

abstract class 
ITSEC_Zxcvbn_Match {
    protected 
$guesses;

    protected static 
$min_year_space 20;
    
/**
     * @todo make this dynamic? Why isn't it?
     */
    
protected static $reference_year 2016;

    
/**
     * Finds matches in the password.
     * @param string $password         Password to check for match
     * @param array  $penalty_strings  Strings that should be penalized if in the password. This should be things like the username, first and last name, etc.
     *
     * @return ITSEC_Zxcvbn_Match[]    Array of Match objects
     */
    
public static function match($password, array $penalty_strings = array()) {}

    protected function 
is_digit$ord ) {
        return 
$ord >= 0x30 && $ord <= 0x39;
    }

    protected function 
is_upper$ord ) {
        return 
$ord >= 0x41 && $ord <= 0x5a;
    }

    protected function 
is_lower$ord ) {
        return 
$ord >= 0x61 && $ord <= 0x7a;
    }

    protected function 
is_symbol$ord ) {
        return 
$ord <= 0x7f;
    }

    
/**
     * http://blog.plover.com/math/choose.html
     *
     * @param $n int
     * @param $k int
     *
     * @return int
     */
    
protected function binomial_coefficient$n$k ) {
        if ( 
$k $n ) {
            return 
0;
        }
        if ( 
=== $k ) {
            return 
1;
        }
        
$r 1;
        for ( 
$d 1$d <= $k$d++ ) {
            
$r *= $n--;
            
$r /= $d;
        }
        return 
$r;
    }

}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586