par
Cyrano » 20 janv. 2006, 18:07
Si j'utilise ce code, avec le pseudo "Cyrano", le mot de passe "php" et en option de salt "bergerac", j'obtiens les trois versions suivantes :
Standard DES
Cyrano:beeoPwPUZdxNk
crypt md5
Cyrano:$1$BA..095.$xFU1STOGZFyg.gNt4r26R0
crypt md5 et salt perso
Cyrano:$1$bergerac$ksQ2280tsfI/LDNdQ.WRi.
Aucun des trois ne fonctionne.
Si on regarde le même généré avec htpasswd.exe en ligne de commande, j'ai celui-ci :
Cyrano:$apr1$JA2.....$tpjb8Ux.0Owqz9djjH4tX0
La différence majeure que je vois est au niveau de la première partie entre les $$ ainsi que la seconde. htpasswd.exe utilise un salt aléatoire peut-être basé sur une variable de timestamp ou quelque chose dans ce goût-là, aucune idée.
Et là, ça marche. J'aimerais drôlement comprendre l'astuce
Note, j'ai posté aussi sur le forum ApacheFrance.com, si on m'y fournit une solution, je sens qu'il va y avoir ici un post documenté dans la FAQ à court terme.
[Edit]
Si je regarde les information données par la ligne de commande :
Code : Tout sélectionner
Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password
htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, NetWare and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.
Il semble que le cryptage MD5 (-m) soit utilisé par défaut sous Windows. Mais comment reproduire la même chose en PHP ?
[/Edit]
Si j'utilise ce code, avec le pseudo "Cyrano", le mot de passe "php" et en option de salt "bergerac", j'obtiens les trois versions suivantes :
[quote][b]Standard DES[/b]
Cyrano:beeoPwPUZdxNk
[b]crypt md5[/b]
Cyrano:$1$BA..095.$xFU1STOGZFyg.gNt4r26R0
[b]crypt md5 et salt perso[/b]
Cyrano:$1$bergerac$ksQ2280tsfI/LDNdQ.WRi.[/quote]
Aucun des trois ne fonctionne.
Si on regarde le même généré avec htpasswd.exe en ligne de commande, j'ai celui-ci :
[quote]Cyrano:$apr1$JA2.....$tpjb8Ux.0Owqz9djjH4tX0[/quote]
La différence majeure que je vois est au niveau de la première partie entre les $$ ainsi que la seconde. htpasswd.exe utilise un salt aléatoire peut-être basé sur une variable de timestamp ou quelque chose dans ce goût-là, aucune idée.
Et là, ça marche. J'aimerais drôlement comprendre l'astuce :?
Note, j'ai posté aussi sur le forum ApacheFrance.com, si on m'y fournit une solution, je sens qu'il va y avoir ici un post documenté dans la FAQ à court terme.
[Edit]
Si je regarde les information données par la ligne de commande :
[code]Usage:
htpasswd [-cmdpsD] passwordfile username
htpasswd -b[cmdpsD] passwordfile username password
htpasswd -n[mdps] username
htpasswd -nb[mdps] username password
-c Create a new file.
-n Don't update file; display results on stdout.
-m Force MD5 encryption of the password (default).
-d Force CRYPT encryption of the password.
-p Do not encrypt the password (plaintext).
-s Force SHA encryption of the password.
-b Use the password from the command line rather than prompting for it.
-D Delete the specified user.
On Windows, NetWare and TPF systems the '-m' flag is used by default.
On all other systems, the '-p' flag will probably not work.[/code]
Il semble que le cryptage MD5 (-m) soit utilisé par défaut sous Windows. Mais comment reproduire la même chose en PHP ?
[/Edit]