domingo, 19 de febrero de 2012

Code fragment for creating a unix password

This fragment can help you out in case you need to manage the native passwords from C for more information type: man crypt.h
 #include 
#include 
#include 
#include 

int main (int argc,char *argv[]) {

        if(argc<3){
                printf("ERROR: params incorrect you must provide a password\n");
                return 1;
        }else{
        char *key=argv[1];
        printf ("%s|",key);
        char *salt=argv[2];
        //char *salt="$5$10$";
        printf ("%s\n",salt);
        char *password = crypt(key, salt);
        puts(password);
        return 0;}

}


No hay comentarios:

Publicar un comentario