-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyPasswordGenerator.xaml
More file actions
564 lines (554 loc) · 41.4 KB
/
MyPasswordGenerator.xaml
File metadata and controls
564 lines (554 loc) · 41.4 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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
<Window x:Class="MyPasswordGenerator.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="My Password Generator"
Height="700"
Width="900"
Background="{DynamicResource WindowBackgroundBrush}">
<Window.Resources>
<!-- Light Theme Brushes -->
<SolidColorBrush x:Key="LightWindowBackgroundBrush"
Color="#FFF"/>
<SolidColorBrush x:Key="LightCardBrush"
Color="#F0F0F0"/>
<SolidColorBrush x:Key="LightTextBrush"
Color="#222"/>
<SolidColorBrush x:Key="LightAccentBrush"
Color="#0078D7"/>
<SolidColorBrush x:Key="LightButtonBrush"
Color="#0078D7"/>
<SolidColorBrush x:Key="LightButtonHoverBrush"
Color="#005A9E"/>
<SolidColorBrush x:Key="LightButtonTextBrush"
Color="#FFF"/>
<SolidColorBrush x:Key="LightBorderBrush"
Color="#C0C0C0"/>
<!-- Dark Theme Brushes -->
<SolidColorBrush x:Key="DarkWindowBackgroundBrush"
Color="#222831"/>
<SolidColorBrush x:Key="DarkCardBrush"
Color="#393E46"/>
<SolidColorBrush x:Key="DarkTextBrush"
Color="#EEEEEE"/>
<SolidColorBrush x:Key="DarkAccentBrush"
Color="#00ADB5"/>
<SolidColorBrush x:Key="DarkButtonBrush"
Color="#222B38"/>
<SolidColorBrush x:Key="DarkButtonHoverBrush"
Color="#00ADB5"/>
<SolidColorBrush x:Key="DarkButtonTextBrush"
Color="#FFFFFF"/>
<SolidColorBrush x:Key="DarkBorderBrush"
Color="#22292F"/>
<!-- Dynamic Theme Bindings -->
<SolidColorBrush x:Key="WindowBackgroundBrush"
Color="{DynamicResource WindowBackgroundColor}"/>
<SolidColorBrush x:Key="CardBrush"
Color="{DynamicResource CardColor}"/>
<SolidColorBrush x:Key="TextBrush"
Color="{DynamicResource TextColor}"/>
<SolidColorBrush x:Key="AccentBrush"
Color="{DynamicResource AccentColor}"/>
<SolidColorBrush x:Key="ButtonBrush"
Color="{DynamicResource ButtonColor}"/>
<SolidColorBrush x:Key="ButtonHoverBrush"
Color="{DynamicResource ButtonHoverColor}"/>
<SolidColorBrush x:Key="ButtonTextBrush"
Color="{DynamicResource ButtonTextColor}"/>
<SolidColorBrush x:Key="DynamicBorderColor"
Color="#C0C0C0"/>
<Style TargetType="PasswordBox">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource CardBrush}"/>
<Setter Property="CaretBrush"
Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderBrush"
Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness"
Value="1"/>
<Setter Property="FontSize"
Value="16"/>
<Setter Property="Margin"
Value="0,2,0,2"/>
</Style>
<!-- Modern Button Style -->
<Style x:Key="ModernButton"
TargetType="Button">
<Setter Property="Background"
Value="{DynamicResource ButtonBrush}"/>
<Setter Property="Foreground"
Value="{DynamicResource ButtonTextBrush}"/>
<Setter Property="FontWeight"
Value="SemiBold"/>
<Setter Property="Padding"
Value="10,4"/>
<Setter Property="Margin"
Value="0,5,0,5"/>
<Setter Property="BorderThickness"
Value="0"/>
<Setter Property="Cursor"
Value="Hand"/>
<Setter Property="FontSize"
Value="15"/>
<Setter Property="SnapsToDevicePixels"
Value="True"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Color="#000"
BlurRadius="8"
Opacity="0.15"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
CornerRadius="8"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter Property="Background"
Value="{DynamicResource ButtonHoverBrush}"/>
</Trigger>
<Trigger Property="IsPressed"
Value="True">
<Setter Property="Opacity"
Value="0.85"/>
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Background"
Value="#888"/>
<Setter Property="Foreground"
Value="#CCC"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Card Style -->
<Style x:Key="CardStyle"
TargetType="GroupBox">
<Setter Property="Background"
Value="{DynamicResource CardBrush}"/>
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="FontWeight"
Value="SemiBold"/>
<Setter Property="Margin"
Value="0,0,0,10"/>
<Setter Property="Padding"
Value="8"/>
<Setter Property="BorderBrush"
Value="{DynamicResource DynamicBorderColor}"/>
<Setter Property="BorderThickness"
Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="GroupBox">
<Grid>
<Border
Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="8">
<DockPanel>
<ContentPresenter
Name="Header"
ContentSource="Header"
RecognizesAccessKey="True"
Margin="8,0,0,0"
VerticalAlignment="Top"
HorizontalAlignment="Left"
DockPanel.Dock="Top"
SnapsToDevicePixels="True"/>
<ContentPresenter
Name="Content"
Margin="0,8,0,0"
ContentSource="Content"
SnapsToDevicePixels="True"/>
</DockPanel>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- TabControl Style -->
<Style TargetType="TabControl">
<Setter Property="Background"
Value="{DynamicResource WindowBackgroundBrush}"/>
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="BorderThickness"
Value="0"/>
</Style>
<!-- TabItem Style -->
<Style TargetType="TabItem">
<Setter Property="Background"
Value="{DynamicResource CardBrush}"/>
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="FontWeight"
Value="SemiBold"/>
<Setter Property="Margin"
Value="2,2,2,0"/>
<Setter Property="Padding"
Value="16,6"/>
<Setter Property="BorderThickness"
Value="0,0,0,0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Border
Name="Border"
Background="{TemplateBinding Background}"
CornerRadius="8,8,0,0"
Padding="{TemplateBinding Padding}">
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header"
RecognizesAccessKey="True"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected"
Value="True">
<Setter TargetName="Border"
Property="Background"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="Foreground"
Value="White"/>
</Trigger>
<Trigger Property="IsEnabled"
Value="False">
<Setter Property="Foreground"
Value="#888"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
</Style>
<Style TargetType="Label">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
</Style>
<Style TargetType="TextBox">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
<Setter Property="Background"
Value="{DynamicResource CardBrush}"/>
<Setter Property="FontFamily"
Value="Consolas"/>
<Setter Property="BorderBrush"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="BorderThickness"
Value="1"/>
<Setter Property="Margin"
Value="0,2,0,2"/>
</Style>
<Style TargetType="CheckBox">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}"/>
</Style>
<Style TargetType="Slider">
<Setter Property="Margin"
Value="0,2,0,2"/>
</Style>
<Style TargetType="ScrollViewer">
<Setter Property="Background"
Value="{DynamicResource WindowBackgroundBrush}"/>
</Style>
<Style TargetType="ProgressBar">
<Setter Property="Foreground"
Value="{DynamicResource AccentBrush}"/>
<Setter Property="Background"
Value="{DynamicResource CardBrush}"/>
</Style>
</Window.Resources>
<Window.DataContext>
<Binding RelativeSource="{RelativeSource Self}"/>
</Window.DataContext>
<Grid>
<DockPanel>
<StackPanel Orientation="Horizontal"
DockPanel.Dock="Top"
HorizontalAlignment="Right"
Margin="0,5,19,0">
<Button Content="🌙 Dark"
Style="{StaticResource ModernButton}"
Width="80"
Margin="8,0,0,0"
Click="SetDarkTheme_Click"/>
<Button Content="☀️ Light"
Style="{StaticResource ModernButton}"
Width="80"
Margin="8,0,0,0"
Click="SetLightTheme_Click"/>
</StackPanel>
<TabControl>
<!-- Password Tab -->
<TabItem Header="Password">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<GroupBox Header="Character Types"
Style="{StaticResource CardStyle}">
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="cbLower"
Content="Lowercase (a-z)"
IsChecked="True"
Margin="0,0,10,0"/>
<CheckBox x:Name="cbUpper"
Content="Uppercase (A-Z)"
IsChecked="True"
Margin="0,0,10,0"/>
<CheckBox x:Name="cbDigits"
Content="Digits (0-9)"
IsChecked="True"
Margin="0,0,10,0"/>
<CheckBox x:Name="cbSymbols"
Content="Symbols (!@#...)"
IsChecked="True"/>
</StackPanel>
</GroupBox>
<GroupBox Header="Length"
Style="{StaticResource CardStyle}">
<StackPanel Orientation="Horizontal">
<Slider x:Name="sliderLength"
Minimum="4"
Maximum="128"
Value="16"
Width="200"
TickFrequency="1"
IsSnapToTickEnabled="True"
AutoToolTipPrecision="0"/>
<TextBlock Text="{Binding Value, ElementName=sliderLength, StringFormat=Length: {0}}"
VerticalAlignment="Center"
Margin="12,0,0,0"/>
</StackPanel>
</GroupBox>
<Button Content="Generate Password"
Style="{StaticResource ModernButton}"
Click="GeneratePassword_Click"
Width="200"/>
<GroupBox Header="Generated Password"
Style="{StaticResource CardStyle}">
<StackPanel>
<TextBox x:Name="txtPassword"
IsReadOnly="True"
FontSize="16"/>
<StackPanel Orientation="Horizontal">
<Button Content="Copy"
Style="{StaticResource ModernButton}"
Click="CopyPassword_Click"
Width="80"/>
<TextBlock x:Name="txtCopiedMessage"
Foreground="LimeGreen"
Visibility="Collapsed"
Text="✓ Copied!"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="Strength Analysis"
Style="{StaticResource CardStyle}">
<StackPanel>
<ProgressBar x:Name="pbStrength"
Height="20"
Maximum="128"
Margin="0,0,0,5"/>
<TextBlock x:Name="tbStrengthText"
Margin="0,0,0,5"
TextWrapping="Wrap"
VerticalAlignment="Center"/>
<TextBox x:Name="txtPasswordDetails"
IsReadOnly="True"
Height="250"/>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
<!-- Passphrase Tab -->
<TabItem Header="Passphrase">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel>
<GroupBox Header="Language"
Style="{StaticResource CardStyle}">
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="cbEnglish"
Content="English Words"
IsChecked="True"
Margin="0,0,10,0"/>
<CheckBox x:Name="cbGerman"
Content="German Words"/>
</StackPanel>
</GroupBox>
<GroupBox Header="Settings"
Style="{StaticResource CardStyle}">
<StackPanel Orientation="Horizontal">
<Slider x:Name="sliderWords"
Minimum="2"
Maximum="20"
Value="5"
Width="120"
TickFrequency="1"
IsSnapToTickEnabled="True"
AutoToolTipPrecision="0"/>
<TextBlock Text="{Binding Value, ElementName=sliderWords, StringFormat=Words: {0}}"
VerticalAlignment="Center"
Margin="12,0,0,0"/>
<TextBlock Text="Separator:"
VerticalAlignment="Center"
Margin="16,0,0,0"/>
<TextBox x:Name="txtSeparator"
Text="-"
Width="40"
MaxLength="3"/>
</StackPanel>
</GroupBox>
<Button Content="Generate Passphrase"
Style="{StaticResource ModernButton}"
Click="GeneratePassphrase_Click"
Width="200"/>
<GroupBox Header="Generated Passphrase"
Style="{StaticResource CardStyle}">
<StackPanel>
<TextBox x:Name="txtPassphrase"
IsReadOnly="True"
FontSize="16"/>
<StackPanel Orientation="Horizontal">
<Button Content="Copy"
Style="{StaticResource ModernButton}"
Click="CopyPassphrase_Click"
Width="80"/>
<TextBlock x:Name="txtCopiedMessagePassphrase"
Foreground="LimeGreen"
Visibility="Collapsed"
Text="✓ Copied!"
VerticalAlignment="Center"
Margin="10,0,0,0"/>
</StackPanel>
</StackPanel>
</GroupBox>
<GroupBox Header="Strength Analysis"
Style="{StaticResource CardStyle}">
<StackPanel>
<TextBox x:Name="txtPassphraseDetails"
IsReadOnly="True"
Height="250"/>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
<!-- Check Password Tab -->
<TabItem Header="Check Password">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="10">
<GroupBox Header="Enter Password"
Style="{StaticResource CardStyle}">
<StackPanel Orientation="Horizontal">
<PasswordBox x:Name="userCheckPasswordBox"
Width="250"
Margin="0,0,10,0"/>
<Button Content="Check"
Style="{StaticResource ModernButton}"
Width="100"
Click="CheckUserPassword_Click"/>
</StackPanel>
</GroupBox>
<GroupBox Header="Strength Analysis"
Style="{StaticResource CardStyle}">
<StackPanel>
<ProgressBar x:Name="pbUserCheckStrength"
Height="20"
Maximum="128"
Margin="0,0,0,5"/>
<TextBlock x:Name="tbUserCheckStrengthText"
Margin="0,0,0,5"/>
<TextBox x:Name="txtUserCheckDetails"
IsReadOnly="True"
Height="150"/>
</StackPanel>
</GroupBox>
</StackPanel>
</ScrollViewer>
</TabItem>
<!-- Info Tab -->
<TabItem Header="Info">
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel Margin="20"
VerticalAlignment="Top">
<TextBlock Text="My Password Generator"
FontWeight="Bold"
FontSize="18"
Margin="0,0,0,10"/>
<TextBlock Text="A modern open-source password generator for Windows."
Margin="0,0,0,5"/>
<TextBlock Text="Version 1.0"
Margin="0,0,0,5"/>
<TextBlock Text="Copyright (c) 2025 Claude Peters"
Margin="0,0,0,16"/>
<Button Content="🌐 GitHub Repository"
Style="{StaticResource ModernButton}"
Width="220"
Margin="0,0,0,16"
Click="OpenGitHub_Click"/>
<Button Content="🔄 Check Updates"
Style="{StaticResource ModernButton}"
Width="220"
Margin="0,0,0,16"
Click="OpenLatestRelease_Click"/>
<TextBlock Margin="0,20,0,0"
TextWrapping="Wrap">
<Run Text="What do the crack time estimates mean?"/>
<LineBreak/><LineBreak/>
<Run Text="• Online (100 guesses/hour): "/>
<Run Text="Simulates an attacker trying to log in to a website that strictly limits login attempts (e.g., 100 tries per hour). Even weak passwords may survive for some time due to slow brute-force."/>
<LineBreak/><LineBreak/>
<Run Text="• Offline (slow hash): "/>
<Run Text="Assumes the attacker has your password hash, and it was generated using a slow, secure algorithm like bcrypt, scrypt, or PBKDF2 (about 10,000 guesses per second). Much harder to crack."/>
<LineBreak/><LineBreak/>
<Run Text="• Offline (fast hash): "/>
<Run Text="Assumes the attacker has your password hash, but it was generated with a fast algorithm like SHA-1, SHA-256, or MD5 (up to 10 billion guesses per second). Weak passwords can be cracked almost instantly."/>
</TextBlock>
<TextBlock Text="This app uses the following third-party library:"
FontWeight="Bold"
Margin="0,20,0,8"/>
<TextBlock TextWrapping="Wrap">
<Run Text="• zxcvbn-cs (Version 7.0.92)"/>
<Hyperlink NavigateUri="https://github.com/trichards57/zxcvbn-cs"
RequestNavigate="Hyperlink_RequestNavigate">
https://github.com/trichards57/zxcvbn-cs
</Hyperlink>
<Run Text=")"/>
<LineBreak/>
<Run Text="MIT License"/>
<LineBreak/>
<Run Text="Copyright (c) 2012 Dropbox, Inc."/>
<LineBreak/>
<Run Text="Copyright (c) 2020 Tony Richards"/>
<LineBreak/>
</TextBlock>
</StackPanel>
</ScrollViewer>
</TabItem>
</TabControl>
</DockPanel>
</Grid>
</Window>