Code Duplication    Length = 13-13 lines in 2 locations

install/install.queries.php 1 location

@@ 56-68 (lines=13) @@
53
 * Generate a hash for user login
54
 * @param string $password
55
 */
56
function bCrypt($password, $cost)
57
{
58
    $salt = sprintf('$2y$%02d$', $cost);
59
    if (function_exists('openssl_random_pseudo_bytes')) {
60
        $salt .= bin2hex(openssl_random_pseudo_bytes(11));
61
    } else {
62
        $chars = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
63
        for ($i = 0; $i < 22; $i++) {
64
            $salt .= $chars[mt_rand(0, 63)];
65
        }
66
    }
67
    return crypt($password, $salt);
68
}
69
70
if (isset($_POST['type'])) {
71
    switch ($_POST['type']) {

sources/main.functions.php 1 location

@@ 244-256 (lines=13) @@
241
 * Generate a hash for user login
242
 * @param string $password
243
 */
244
function bCrypt($password, $cost)
245
{
246
    $salt = sprintf('$2y$%02d$', $cost);
247
    if (function_exists('openssl_random_pseudo_bytes')) {
248
        $salt .= bin2hex(openssl_random_pseudo_bytes(11));
249
    } else {
250
        $chars = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
251
        for ($i = 0; $i < 22; $i++) {
252
            $salt .= $chars[mt_rand(0, 63)];
253
        }
254
    }
255
    return crypt($password, $salt);
256
}
257
258
function cryption_before_defuse($message, $sk, $iv, $type = null, $scope = "public")
259
{