Le dim 21/07/2002 à 14:18, Alain Tesio a écrit : > On 21 Jul 2002 14:12:38 +0200 > Romain DEGEZ <rdegez@ouhyeah.com> wrote: > > > htpasswd kesako ? > > > > "htpasswd is used to create and update the flat-files used to store > > usernames and password for basic authenticationof HTTP users." > > Ci-joint un script perl qui gère aussi un salt comme demandé par > le post initial. > > Alain Ci-joint la meme chose que je viens de faire en c (pas super elegant mais ca marche) a partir du .pl. a compiler avec : gcc crypt.c -lcrypt -o crypt_passwd -- DEGEZ Romain -- EPITECH Promo 2006 Administrateur Systemes & Reseaux pour SmartJog (Video broadcasting) President de Cycom l'assocation de jeux en reseau de l'EPITA/EPITECH Debian GNU/Linux user -- UIN: 10806422 -- mail: rdegez@ouhyeah.com GPG Fingerprint : FD0B AF56 EDC1 98ED 95B9 636F B5D2 4CAB 0B36 3FE2
/* ** crypt.c for crypt_passwd */ #include <stdio.h> #include <stdlib.h> #include <time.h> #define _XOPEN_SOURCE_ #include <unistd.h> int majormin() { int randletter; srandom(random()); randletter = random() % 26; srandom(random()); if (random() % 2 > 0) return (randletter+= 65); else return (randletter+= 97); } int main(int ac, char **av) { char salt[3]; if (ac != 2) { printf("usage : %s password\n", av[0]); exit (0); } srandom(time(0)); srandom(random()); salt[0] = majormin(); salt[1] = majormin(); salt[2] = '\0'; printf("%s\n", crypt(av[1], salt)); return (0); }
Attachment:
signature.asc
Description: PGP signature