crypt 함수를 이용해서 암호키를 만들었는데 안되네요.
글쓴이: mudori / 작성시간: 월, 2004/01/05 - 6:02오후
모양새는 그럭저럭 비슷하게 나오나 접속이 되지 않습니다.
어케해야 잘 만들까요?
#define _XOPEN_SOURCE
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <crypt.h>
int main(int argc, char *argv) {
unsigned long seed[2];
char salt[] = "$1$........";
const char *const seedchars =
"./0123456789ABCDEFGHIJKLMNOPQRST"
"UVWXYZabcdefghijklmnopqrstuvwxyz";
char *password;
int i;
seed[0] = time(NULL);
seed[1] = getpid() ^ (seed[0] >> 14 & 0x30000);
for (i = 0; i < 8; i++)
salt[3+i] = seedchars[(seed[i/5] >> (i%5)*6) & 0x3f];
password = crypt(("argv[1]"), salt);
puts(password);
return 0;
}
이렇게 했는데 암호화는 잘 되어 나오는데 shadow에 붙여서 로그인해보면 안되네요.
Forums:
댓글 달기