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

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