Overview
Comment:Ne pas utiliser shuffle/array_rand pour la crypto, utiliser quelque chose de sécurisé
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 91685a01458f77281f05c94783476f084e0ae59c
User & Date: bohwaz on 2017-01-27 00:24:49
Other Links: branch diff | manifest | tags
Context
2017-01-27
00:26
Ne calculer la longueur qu'une seule fois check-in: 257cb45cb0 user: bohwaz tags: dev
00:24
Ne pas utiliser shuffle/array_rand pour la crypto, utiliser quelque chose de sécurisé check-in: 91685a0145 user: bohwaz tags: dev
2017-01-26
23:58
OTP : utilisation du temps NTP si le code ne marche pas, c'est ptet que le serveur n'est pas à l'heure check-in: 5fe5ad7b22 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Membres.php from [c169b1e8c6] to [8ea0f4ea30].

9
10
11
12
13
14
15
16
17
18
19
20
21
22




23

24
25
26
27
28
29
30
    const DROIT_ECRITURE = 2;
    const DROIT_ADMIN = 9;

    const ITEMS_PER_PAGE = 50;

    protected function _getSalt($length)
    {
        $str = str_split('./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789');
        shuffle($str);

        return implode('',
            array_rand(
                $str,
                $length)




        );

    }

    protected function _hashPassword($password)
    {
        $salt = '$2a$08$' . $this->_getSalt(22);
        return crypt($password, $salt);
    }







|
<
|
|
|
<
|
>
>
>
>
|
>







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
    const DROIT_ECRITURE = 2;
    const DROIT_ADMIN = 9;

    const ITEMS_PER_PAGE = 50;

    protected function _getSalt($length)
    {
        static $str = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

        
        $out = '';


        for ($i = 0; $i < $length; $i++)
        {
            $random = \KD2\Security::random_int(0, strlen($str) - 1);
            $out .= $str[$random];
        }

        return $out;
    }

    protected function _hashPassword($password)
    {
        $salt = '$2a$08$' . $this->_getSalt(22);
        return crypt($password, $salt);
    }