Added experimental makepkg-update-checksums.sh
[mirrors/Programs.git] / c / biometrics / biom.c
CommitLineData
21c4e167
H
1#include <stdio.h>
2#include <time.h>
3#include <math.h>
4
5#define PWSIZE 32
6#define TIMERES 1000
7
8int main() {
9
10while(1) printf("c: %d, cps %d\n", clock(), CLOCKS_PER_SEC);
11
12char passwd[PWSIZE], loginpasswd[PWSIZE];
13long timestamp[PWSIZE], logintimestamp;
14int i, sensitivity = 200;
15
16setbuf(stdin, NULL);
17setbuf(stdout, NULL);
18
19
20printf("Enter new pwd: ");
21for(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}
32passwd[i] = 0;
33
34while(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.840849 seconds and 4 git commands to generate.