File size: 8,139 Bytes
815e811
629c95c
815e811
 
629c95c
 
815e811
629c95c
815e811
629c95c
 
 
 
 
 
 
 
 
 
815e811
 
 
 
 
629c95c
 
 
 
 
 
 
 
815e811
 
629c95c
815e811
629c95c
 
 
815e811
 
629c95c
 
 
 
815e811
 
629c95c
 
 
 
 
 
 
 
 
815e811
 
629c95c
 
 
815e811
 
629c95c
 
815e811
 
629c95c
 
 
 
815e811
 
629c95c
 
 
 
 
 
 
 
 
815e811
 
629c95c
 
 
815e811
 
629c95c
 
 
 
815e811
 
629c95c
 
 
 
 
 
 
 
 
 
 
815e811
 
629c95c
 
 
 
815e811
629c95c
 
 
 
 
 
 
 
815e811
629c95c
 
 
 
815e811
629c95c
 
815e811
 
629c95c
 
 
 
815e811
629c95c
 
 
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
815e811
 
629c95c
 
 
 
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
 
815e811
 
629c95c
 
 
 
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
815e811
629c95c
815e811
629c95c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
815e811
629c95c
815e811
 
 
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RC4 Encoder/Decoder</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: -apple-system, system-ui, sans-serif;
        }

        body {
            min-height: 100vh;
            background: linear-gradient(45deg, #1a1c20, #2d3436);
            color: #fff;
            padding: 20px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .container {
            width: 100%;
            max-width: 800px;
            background: rgba(255, 255, 255, 0.05);
            padding: 2rem;
            border-radius: 12px;
            backdrop-filter: blur(10px);
            box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
        }

        h1 {
            text-align: center;
            margin-bottom: 2rem;
            color: #00ff9d;
            font-size: 2rem;
        }

        .tabs {
            display: flex;
            margin-bottom: 2rem;
            border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        }

        .tab {
            padding: 1rem 2rem;
            cursor: pointer;
            background: none;
            border: none;
            color: #fff;
            font-size: 1rem;
            opacity: 0.6;
            transition: all 0.3s;
        }

        .tab.active {
            opacity: 1;
            border-bottom: 2px solid #00ff9d;
        }

        .input-group {
            margin-bottom: 1.5rem;
        }

        label {
            display: block;
            margin-bottom: 0.5rem;
            color: #00ff9d;
        }

        textarea, input {
            width: 100%;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            color: #fff;
            font-size: 1rem;
            transition: all 0.3s;
        }

        textarea {
            min-height: 120px;
            resize: vertical;
        }

        textarea:focus, input:focus {
            outline: none;
            border-color: #00ff9d;
            background: rgba(255, 255, 255, 0.1);
        }

        button {
            width: 100%;
            padding: 1rem;
            background: #00ff9d;
            border: none;
            border-radius: 8px;
            color: #1a1c20;
            font-size: 1rem;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.3s;
        }

        button:hover {
            background: #00cc7d;
            transform: translateY(-2px);
        }

        .result {
            margin-top: 1.5rem;
            padding: 1rem;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 8px;
            word-break: break-all;
            min-height: 60px;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .show {
            animation: fadeIn 0.3s ease-out;
        }

        @media (max-width: 600px) {
            .container {
                padding: 1rem;
            }
            
            .tab {
                padding: 0.8rem 1rem;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>RC4 Encoder/Decoder</h1>
        
        <div class="tabs">
            <button class="tab active" onclick="switchTab('decode')" id="decodeTab">Decode</button>
            <button class="tab" onclick="switchTab('encode')" id="encodeTab">Encode</button>
        </div>

        <div id="decodeSection">
            <div class="input-group">
                <label>Base64 Encoded Text:</label>
                <textarea id="decodeInput" placeholder="Enter base64 encoded text..."></textarea>
            </div>

            <div class="input-group">
                <label>RC4 Key:</label>
                <input type="text" id="decodeKey" placeholder="Enter RC4 key...">
            </div>

            <button onclick="decode()">Decode</button>
            <div class="result" id="decodeResult"></div>
        </div>

        <div id="encodeSection" style="display: none;">
            <div class="input-group">
                <label>Text to Encode:</label>
                <textarea id="encodeInput" placeholder="Enter text to encode..."></textarea>
            </div>

            <div class="input-group">
                <label>RC4 Key:</label>
                <input type="text" id="encodeKey" placeholder="Enter RC4 key...">
            </div>

            <button onclick="encode()">Encode</button>
            <div class="result" id="encodeResult"></div>
        </div>
    </div>

    <script>
        function rc4(key, str) {
            let s = [], j = 0, x, res = '';
            for (let i = 0; i < 256; i++) {
                s[i] = i;
            }
            for (let i = 0; i < 256; i++) {
                j = (j + s[i] + key.charCodeAt(i % key.length)) % 256;
                x = s[i];
                s[i] = s[j];
                s[j] = x;
            }
            let i = 0;
            j = 0;
            for (let y = 0; y < str.length; y++) {
                i = (i + 1) % 256;
                j = (j + s[i]) % 256;
                x = s[i];
                s[i] = s[j];
                s[j] = x;
                res += String.fromCharCode(str.charCodeAt(y) ^ s[(s[i] + s[j]) % 256]);
            }
            return res;
        }

        function decode() {
            const input = document.getElementById('decodeInput').value;
            const key = document.getElementById('decodeKey').value;
            const result = document.getElementById('decodeResult');

            try {
                const decodedBase64 = atob(input);
                const decryptedText = rc4(key, decodedBase64);
                
                result.textContent = decryptedText;
                result.classList.remove('show');
                void result.offsetWidth;
                result.classList.add('show');
            } catch (e) {
                result.textContent = 'Error: Invalid input or key';
                result.classList.add('show');
            }
        }

        function encode() {
            const input = document.getElementById('encodeInput').value;
            const key = document.getElementById('encodeKey').value;
            const result = document.getElementById('encodeResult');

            try {
                const encryptedText = rc4(key, input);
                const encodedBase64 = btoa(encryptedText);
                
                result.textContent = encodedBase64;
                result.classList.remove('show');
                void result.offsetWidth;
                result.classList.add('show');
            } catch (e) {
                result.textContent = 'Error: Invalid input or key';
                result.classList.add('show');
            }
        }

        function switchTab(tab) {
            const decodeSection = document.getElementById('decodeSection');
            const encodeSection = document.getElementById('encodeSection');
            const decodeTab = document.getElementById('decodeTab');
            const encodeTab = document.getElementById('encodeTab');

            if (tab === 'decode') {
                decodeSection.style.display = 'block';
                encodeSection.style.display = 'none';
                decodeTab.classList.add('active');
                encodeTab.classList.remove('active');
            } else {
                decodeSection.style.display = 'none';
                encodeSection.style.display = 'block';
                decodeTab.classList.remove('active');
                encodeTab.classList.add('active');
            }
        }
    </script>
</body>
</html><script async data-explicit-opt-in="true" data-cookie-opt-in="true" src="https://vercel.live/_next-live/feedback/feedback.js"></script>