Verbal   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 46
dl 0
loc 91
rs 10
c 0
b 0
f 0
wmc 5

1 Method

Rating   Name   Duplication   Size   Complexity  
A hashAlgo() 0 24 5
1
<?php
2
/**
3
 * Crypsic - A speed metal encryption library for php
4
 *
5
 * @category   Encryption And Password
6
 *
7
 * @author     Moviet
8
 * @license    MIT Public License
9
 *
10
 * @return     @Defaultconfiguration
11
 */
12
namespace Moviet\Heavy\Speed;
13
14
abstract class Verbal
15
{
16
    const MIN_BYTES_SIZE = 16;
17
18
    const MEDIUM_BYTES_SIZE = 24;
19
20
    const MAX_BYTES_SIZE = 32;
21
22
    const BYTES_CONVERSION = 48;
23
24
    const KEEP_BYTES_CLEAN = null;
25
26
    const CHBYTES = '8bit';
27
28
    const ZERO_BITS_FIXED = 0;
29
30
    const MIN_CIPHER_SIZE = 128;
31
32
    const MEDIUM_CIPHER_SIZE = 192;
33
34
    const MAX_CIPHER_SIZE = 256;
35
36
    const HMAC_GIVER = 'sha256';
37
38
    const DEFAULT_MODE = 'CBC-256';	
39
40
    const RAWKEY_ALGOS = 'sha512';
41
42
    const BLOCK_MODE = 
43
    [
44
        'CTR-128'  	=> 'AES-128-CTR',
45
46
        'CTR-192'  	=> 'AES-192-CTR',
47
48
        'CTR-256'  	=> 'AES-256-CTR',
49
50
        'CBC-128'  	=> 'AES-128-CBC',
51
52
        'CBC-192'  	=> 'AES-192-CBC',
53
54
        'CBC-256'  	=> 'AES-256-CBC'
55
    ];
56
57
    const DEFAULT_COST = 'cost';
58
59
    const DEFAULT_COST_LENGTH = 14;
60
61
    const MEMORY_KEY = 'memory_cost';
62
63
    const TIME_KEY = 'time_cost';
64
65
    const THREAD_KEY = 'threads';
66
67
    const OPTIONS_KEY = 'options';
68
69
    const DEFAULT_MEMORY_COST = 1666;
70
71
    const DEFAULT_TIME_COST = 6;
72
73
    const DEFAULT_THREAD_LENGTH = 6;
74
75
    /**
76
     * Generate password compatible suits
77
     * 
78
     * @param string $algorithm
79
     * @return string
80
     */
81
    public static function hashAlgo($algorithm)
82
    {
83
        switch ($algorithm) {
84
            case 'Default' :
85
            $algoName = PASSWORD_DEFAULT;
86
            break;
87
88
            case 'Argon2i' :
89
            $algoName = PASSWORD_ARGON2I;
90
            break;
91
92
            case 'Argon2d' :
93
            $algoName = PASSWORD_ARGON2D;
0 ignored issues
show
Bug introduced by
The constant Moviet\Heavy\Speed\PASSWORD_ARGON2D was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
94
            break;
95
96
            case 'Argon2id' :
97
            $algoName = PASSWORD_ARGON2ID;
0 ignored issues
show
Bug introduced by
The constant Moviet\Heavy\Speed\PASSWORD_ARGON2ID was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
98
            break;
99
100
            default :
101
            break;
102
        }
103
104
        return $algoName;
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $algoName does not seem to be defined for all execution paths leading up to this point.
Loading history...
105
    }
106
}
107