-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
271 lines (238 loc) · 6.89 KB
/
index.html
File metadata and controls
271 lines (238 loc) · 6.89 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
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
267
268
269
270
271
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Replace the Reused</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;900&display=swap">
<script src="https://cdnjs.cloudflare.com/ajax/libs/zxcvbn/4.4.2/zxcvbn.js"></script>
<style>
* {
box-sizing: border-box;
font-family: 'Inter', sans-serif;
scroll-behavior: smooth;
}
body {
background: #0d1117;
color: #c9d1d9;
margin: 0;
padding: 0;
overflow-x: hidden;
}
/* HERO SECTION */
.hero {
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
padding: 0 20px;
}
.hero h1:first-child {
font-size: clamp(2.5rem, 6vw, 6rem);
font-weight: 950;
color: white;
margin: 0;
}
.hero h1.gradient {
font-size: clamp(2.3rem, 5.5vw, 5.5rem);
font-weight: 950;
background: linear-gradient(90deg, #fbbf24, #f97316, #a78bfa, #60a5fa);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
margin: 0;
}
.hero h3 {
font-size: 1.2rem;
color: #8b949e;
font-weight: 400;
margin-top: 20px;
margin-bottom: 50px;
max-width: 600px;
}
.scroll-down {
color: #58a6ff;
text-decoration: none;
font-weight: 600;
font-size: 1rem;
border: 2px solid #58a6ff;
padding: 10px 20px;
border-radius: 50px;
transition: background 0.3s;
}
.scroll-down:hover {
background: #58a6ff;
color: #0d1117;
}
/* GENERATOR SECTION */
section {
display: flex;
flex-direction: column;
align-items: center;
padding: 100px 20px;
}
section h1 {
color: #58a6ff;
font-size: 1.8rem;
margin-bottom: 10px;
text-align: center;
}
.container {
background: #161b22;
padding: 25px;
border-radius: 16px;
box-shadow: 0 0 20px rgba(88,166,255,0.1);
width: 100%;
max-width: 420px;
}
input {
width: 100%;
padding: 10px;
border: none;
border-radius: 8px;
background: #21262d;
color: #fff;
margin-bottom: 15px;
outline: none;
}
button {
width: 100%;
padding: 10px;
border: none;
border-radius: 8px;
background: #238636;
color: white;
font-weight: 600;
cursor: pointer;
transition: background 0.2s;
}
button:hover {
background: #2ea043;
}
#resultBox {
margin-top: 15px;
display: none;
}
#result {
background: #0d1117;
padding: 10px;
border-radius: 8px;
word-break: break-all;
font-family: monospace;
margin-bottom: 5px;
}
#strength {
font-size: 14px;
color: #8b949e;
}
.copy-btn {
background: #30363d;
color: #58a6ff;
padding: 6px 10px;
border-radius: 6px;
cursor: pointer;
font-size: 12px;
float: right;
margin-bottom: 10px;
}
p.note {
font-size: 12px;
color: #8b949e;
margin-top: 10px;
text-align: center;
}
</style>
</head>
<body>
<!-- HERO -->
<div class="hero">
<h1>Replace Your Reused</h1>
<h1 class="gradient">Passwords</h1>
<h3>Don’t let one password unlock everything you own.</h3>
<a href="#generator" class="scroll-down">Scroll to Generator ↓</a>
</div>
<!-- GENERATOR SECTION -->
<section id="generator">
<h1>Smart Password Generator</h1>
<div class="container">
<input type="text" id="userWords" placeholder="Your words (e.g. star, 2030, moon)" />
<button id="generateBtn">Generate Password</button>
<div id="resultBox">
<div id="result"></div>
<span id="copyBtn" class="copy-btn">Copy</span>
<div id="strength"></div>
</div>
<p class="note">
All passwords are generated locally. Nothing is stored or shared.
</p>
</div>
</section>
<script>
function secureRandomInt(max) {
const array = new Uint32Array(1);
crypto.getRandomValues(array);
return array[0] % max;
}
function fisherYatesShuffle(array) {
for (let i = array.length - 1; i > 0; i--) {
const j = secureRandomInt(i + 1);
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
function generatePassword(words) {
const list = words.split(/[\s,]+/).map(w => w.trim()).filter(Boolean);
if (list.length === 0) return "Please enter some words first.";
const symbols = ['!', '@', '#', '$', '%', '&', '*'];
const randomSymbol = symbols[secureRandomInt(symbols.length)];
const randomNum = secureRandomInt(10000);
const mixed = list.map(word =>
word.split('').map(ch => (secureRandomInt(2) ? ch.toUpperCase() : ch)).join('')
);
fisherYatesShuffle(mixed);
let salt = '';
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for (let i = 0; i < 8; i++) salt += chars[secureRandomInt(chars.length)];
return mixed.join('') + randomSymbol + randomNum + salt;
}
document.getElementById('generateBtn').addEventListener('click', () => {
const userWords = document.getElementById('userWords').value;
const password = generatePassword(userWords);
const resultBox = document.getElementById('resultBox');
const result = document.getElementById('result');
const strength = document.getElementById('strength');
resultBox.style.display = 'block';
result.textContent = password;
if (password.startsWith("Please")) {
strength.textContent = '';
return;
}
try {
const analysis = typeof zxcvbn === 'function' ? zxcvbn(password) : null;
if (analysis) {
strength.innerHTML = `
<strong>Strength:</strong> ${['Very Weak', 'Weak', 'Fair', 'Strong', 'Very Strong'][analysis.score]}<br>
Estimated crack time: ${analysis.crack_times_display.offline_fast_hashing_1e10_per_second}
`;
} else {
strength.textContent = 'Strength check unavailable (zxcvbn not loaded).';
}
} catch {
strength.textContent = 'Error analyzing password strength.';
}
});
document.getElementById('copyBtn').addEventListener('click', () => {
const password = document.getElementById('result').textContent;
navigator.clipboard.writeText(password).then(() => {
document.getElementById('copyBtn').textContent = "Copied!";
setTimeout(() => {
document.getElementById('copyBtn').textContent = "Copy";
}, 1500);
}).catch(() => {
alert("Could not copy password. Try manually selecting and copying it.");
});
});
</script>
</body>
</html>