Code Duplication    Length = 13-13 lines in 2 locations

install/install.queries.php 1 location

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

sources/main.functions.php 1 location

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