Added experimental makepkg-update-checksums.sh
[mirrors/Programs.git] / c / biometrics / biom.c
1 #include <stdio.h>
2 #include <time.h>
3 #include <math.h>
4
5 #define PWSIZE 32
6 #define TIMERES 1000
7
8 int main() {
9
10 while(1) printf("c: %d, cps %d\n", clock(), CLOCKS_PER_SEC);
11
12 char passwd[PWSIZE], loginpasswd[PWSIZE];
13 long timestamp[PWSIZE], logintimestamp;
14 int i, sensitivity = 200;
15
16 setbuf(stdin, NULL);
17 setbuf(stdout, NULL);
18
19
20 printf("Enter new pwd: ");
21 for(i=0;i<(PWSIZE-1);i++) {
22 clock();
23 passwd[i] = getchar();
24 if(passwd[i] == '\n') {
25 i++;
26 break;
27 }
28 putchar('*');
29 timestamp[i] = 0;
30 timestamp[i] += clock()/CLOCKS_PER_SEC;
31 }
32 passwd[i] = 0;
33
34 while(1) {
35
36 printf("Enter login pwd: ");
37 for(i=0;i<(PWSIZE-1);i++) {
38 clock();
39 if(getchar() != passwd[i]) {
40 printf("\nIncorrect!\n");
41 break;
42 }
43 logintimestamp = 0;
44 logintimestamp += clock()/CLOCKS_PER_SEC;
45 logintimestamp -= timestamp[i];
46 if(sqrt(logintimestamp*logintimestamp) > sensitivity) {
47 printf("\nIncorrect timing!\n");
48 break;
49 }
50 }
51
52 }
53
54
55
56 }
This page took 0.895061 seconds and 4 git commands to generate.