-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathET.java
More file actions
140 lines (108 loc) · 2.98 KB
/
ET.java
File metadata and controls
140 lines (108 loc) · 2.98 KB
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package thirdPhase;
import java.awt.event.*;
import javax.swing.*;
public class ET extends JFrame implements ActionListener {
private static final long serialVersionUID = 1L;
int valP = 0;
JPanel Pan1 = new JPanel();
JLabel T = new JLabel("ENTER THE MESSAGE YOU WANT TO ENCRYPT BELOW :");
JLabel E = new JLabel("ENCRYPTED MESSAGE :");
JTextArea En = new JTextArea();
JTextArea G = new JTextArea();
JButton Enc = new JButton("ENCRYPT");
JButton B = new JButton("BACK");
ET(){
super("Encryption Terminal");
Pan1.setLayout(null);
add(Pan1);
setSize(1365,740);
setVisible(true);
setResizable(false);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Prop1();
}
void Prop1() {
Pan1.add(T);
Pan1.add(E);
Pan1.add(En);
Pan1.add(G);
Pan1.add(Enc);
Pan1.add(B);
T.setBounds(10,10,400,40);
G.setBounds(10,50,1340,250);
E.setBounds(10,300,300,40);
En.setBounds(10,340,1340,250);
Enc.setBounds(40,620,100,25);
Enc.addActionListener(this);
B.setBounds(270,620,100,25);
B.addActionListener(this);
}
public void actionPerformed(ActionEvent bb) {
int n=0, j=0, k=0;
if(bb.getSource() == Enc) {
char a[] = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',' ','.','1','2','3','4','5','6','7','8','9','0',','};
String s = G.getText();
int l = s.length(), val = 0;
System.out.println(valP+" "+val);
for(int i = 0; i<100; i++) {
val = (int) System.currentTimeMillis();
val = val%1000;
val = val%10 + val%100;
if(val == valP) {
val++;
}
valP = val;
if(val>99) {
val %= 100;
}
if(val<=9 || val == 0) {
val += 10;
}
}
System.out.println(">>"+valP+" "+val);
char[] b = s.toCharArray();
while(n != l){
System.out.println(">> 1 "+val);
if(k == l/2 || k == (l/2)+1){
k++;
}
if(b[n] == a[j]){
System.out.println(">> 2 "+val);
if(l<20){
System.out.println("ERROR!!\nMINIMUM CHARACTER LENGTH IS 20.\n");
break;
}else if(l == 26){
if( j+l+val >= 65){
int aa;
aa = (j+l+val)%65;
System.out.println(">> 3 "+val);
j = aa - l - val;
System.out.println(">>J = "+j);
}
b[k] = a[j+l+val];
}else{
if( j+l+13+val >= 65){
System.out.println(">>J1 = "+j);
int aa;
aa = (j+l+13+val)%65;
System.out.println(">> 3.1 "+val);
j = aa - l - 13 - val;
System.out.println(">>J = "+j);
}
b[k] = a[j+l+13+val];
}
n = n+1;
k = k+1;
j = -1;
}
j = j+1;
}
String ss = String.valueOf(b);
En.setText(ss);
}
if(bb.getSource() == B) {
new Main();
dispose();
}
}
}