-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashController.c
56 lines (54 loc) · 1.67 KB
/
HashController.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
#include<stdio.h>
/*Program to generate hash from different parts of audio and image byte array generated*/
int main()
{
int i,n;
char name[100];
FILE *fp;
for(i=0;i<10;i++)
{
/*Choose which audio byte file to hash based on the status of CPU*/
fp = fopen("/proc/stat","r");
fscanf(fp,"%*s %d",&n);
fclose(fp);
if(n%2==0)
{
/*Execute CRC hash algorithm*/
system("cc CRCHash.c -o CRC");
sprintf(name,"./CRC <aud%d.txt",i);
system(name);
system("rm CRC");
}
else
{
/*Execute PJW hash algorithm*/
system("cc PJWHash.c -o PJW");
sprintf(name,"./PJW <aud%d.txt",i);
system(name);
system("rm PJW");
}
}
for(i=0;i<10;i++)
{
/*Choose which image byte file to hash based on the status of CPU*/
fp = fopen("/proc/stat","r");
fscanf(fp,"%*s %d",&n);
fclose(fp);
if(n%2==0)
{
/*Execute CRC hash algorithm*/
system("cc CRCHash.c -o CRC");
sprintf(name,"./CRC <img%d.txt",i);
system(name);
system("rm CRC");
}
else
{
/*Execute PJW hash algorithm*/
system("cc PJWHash.c -o PJW");
sprintf(name,"./PJW <img%d.txt",i);
system(name);
system("rm PJW");
}
}
}