-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8_1-mypass.c
72 lines (54 loc) · 1.18 KB
/
8_1-mypass.c
1
2
3
4
5
6
7
8
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Auteur(s):
*/
#include <sys/time.h>
#include <stdio.h>
#include <termios.h>
#include <stdlib.h>
#define _XOPEN_SOURCE /* Voir le man 3 crypt */
#include <unistd.h>
/* #include <crypt.h> */
#define BUFSIZE 64
char *c_key =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
char getkey() {
long nb;
struct timeval tp;
/* ?????????????????????????? */
return c_key[0 /* remplcarer le 0 par la bonne valeur */ ];
}
int setsilent(struct termios *initial_term) {
int r;
struct termios term;
/* ??????????????????????????????? */
return 0;
}
int restaure_term(struct termios *initial_term) {
?????
return 0;
}
/* a utiliser au 8.4 */
char *get_pass() {
static char buf[BUFSIZE];
char c;
int i = 0;
while ((c = getchar()) != '\n') {
buf[i++] = c;
putchar('*');
}
buf[i] = '\0';
putchar('\n');
return buf;
}
int main() {
int r;
char buf[BUFSIZE], *s, *pwd;
struct termios initial_term;
printf("key = %s\n", key);
printf("Tapez votre mot de passe : ");
setsilent(&initial_term);
s = fgets(buf, BUFSIZE, stdin);
printf("Mot de passe chiffre : %s\n", pwd);
restaure_term(&initial_term);
exit(EXIT_SUCCESS);
}