-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecryption array allocation.cpp
67 lines (67 loc) · 1.34 KB
/
decryption array allocation.cpp
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
#include <iostream>
#include <iomanip>
#include <fstream>
#include <stdio.h>
#include<sstream>
#include <stdlib.h>
#include<string.h>
using namespace std;
void decrypt()
{
FILE *file;
file=fopen("encrypt.txt","r");
int count=0;
char ch;
while((ch=fgetc(file))!=EOF)
{
count++;
}
fclose(file);
int m=(count/16)/2;
string a[m][4][4],b[m][4][4];
file=fopen("encrypt.txt","r");
int i,j,k,l;
ofstream MyEnfile("decrypt.txt");
string var[2];
string ch2;
for(int k=0;k<m;k++)
{
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
for(int l=0;l<2;l++)
{
ch2=fgetc(file);
var[l]=ch2;
}
string item;
item=var[0] + var[1];
a[k][i][j]=item;
}
}
}
for(int k=0;k<m;k++)
{
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
stringstream ss;
ss<<hex<<a[k][i][j];
unsigned int hexv;
ss>>hexv;
cout<<"["<<static_cast<char>(hexv)<<"] ";
}
cout<<endl;
}
cout<<endl;
cout<<endl;
cout<<endl;
}
}
int main()
{
decrypt();
return 0;
}