-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfohex.c
More file actions
101 lines (55 loc) · 950 Bytes
/
fohex.c
File metadata and controls
101 lines (55 loc) · 950 Bytes
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#include<stdio.h>
int main(int argc,char *argv[]){
char *numara = argv[1];
if(argc != 3){
printf("usage ./find1 value patternsize\n");
return 1;
}
char bigA;
char smallA;
char num;
char *output;
bigA = 65;
smallA = 97;
num = 48;
int sayi = atoi(argv[2]);
for(int i=0;i<sayi;i++){
output[i] = bigA;
output[i+1] = smallA;
output[i+2] =num;
i = i+2 ;
num++;
if(num == 58){
smallA++;
num = 48;
}
if(smallA == 123){
bigA++;
smallA = 97;
num = 48;
}
}
output[sayi] = '\0';
int *deger = malloc(4 *sizeof(int));
int counter = 0;
for(int i=0;i<8;i+=2){
int head = (numara[i] -'0')*16;
int tail = (numara[i+1] - '0');
deger[counter] = head + tail;
counter++;
}
for(int i=0;i<=sayi;i++){
if(deger[3] == output[i]){
if(deger[2] == output[i+1]){
if(deger[1] == output[i+2]){
if(deger[0] == output[i+3]){
printf("offset:%d\n",i);
return 0;
}
}
}
}
}
printf("Eşleşme bulunamadı!\n");
return 0;
}