-
Notifications
You must be signed in to change notification settings - Fork 1
/
password-manager.html
executable file
·774 lines (687 loc) · 35.6 KB
/
password-manager.html
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
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<!DOCTYPE html>
<html>
<!--
Password creator. Uses a web site name and a pass phrase to create and manage your
private passwords for all your web services securely.
Created by Jacob Kanev, 2017.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
For a copy of the GNU General Public License see <http://www.gnu.org/licenses/>.
-->
<head>
<title>Password Manager</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style>
html, body {
background-color: #CCC;
width: 100vw;
height: 100vh;
margin: 0;
padding: 0;
border: 0;
font-family: Sans-Serif;
overflow: hidden;
}
h1 {
font-size: 1.2em;
font-family: inherit;
font-weight: bold;
line-height: 0.2em;
text-align: center;
}
h2 {
font-size: 1.1em;
font-family: inherit;
font-weight: normal;
line-height: 1em;
text-align: center;
}
button.large {
position: relative;
float: left;
margin: 0.5em;
width: 14.99em; /* Chrome, Chromium and Chrome-Canary are fine with 15em. Firefox breaks them to the next line, but is fine with 14.99em. Can't we make different browsers behave the same way, please? */
border: 1px solid #CCC;
-webkit-box-shadow: #DDD 0px 2px 2px ;
-moz-box-shadow: #DDD 0px 2px 2px ;
box-shadow: #DDD 0px 2px 2px ;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 10px 10px 10px 10px;
text-shadow: 1px 1px 1px rgba(0,0,0,1);
color: #EEE;
background-color: #F7F5F6;
background-image: -webkit-gradient(linear, left top, left bottom, from(#AAA), to(#555));
background-image: -webkit-linear-gradient(top, #AAA, #555);
background-image: -moz-linear-gradient(top, #AAA, #555);
background-image: -ms-linear-gradient(top, #AAA, #555);
background-image: -o-linear-gradient(top, #AAA, #555);
background-image: linear-gradient(to bottom, #AAA, #555);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#AAA, endColorstr=#555);
white-space: normal;
font-size: 1em;
}
select {
border:1px solid #ADADAD;
background-color: #E0E0E0;
width: 100%;
margin: 1em 0 1em 0;
padding: 0.5em 1em 0.5em 1em;
height: 3em;
}
button.large:hover{
border:1px solid #ADADAD;
background-color: #E0E0E0;
background-image: -webkit-gradient(linear, left top, left bottom, from(#78b), to(#358));
background-image: -webkit-linear-gradient(top, #78b, #358);
background-image: -moz-linear-gradient(top, #78b, #358);
background-image: -ms-linear-gradient(top, #78b, #358);
background-image: -o-linear-gradient(top, #78b, #358);
background-image: linear-gradient(to bottom, #78b, #358);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#78b, endColorstr=#358);
}
button.large:active{
border:1px solid #ADADAD;
background-color: #E0E0E0;
background-image: -webkit-gradient(linear, left top, left bottom, from(#BDBBBC), to(#E0E0E0));
background-image: -webkit-linear-gradient(top, #BDBBBC, #E0E0E0);
background-image: -moz-linear-gradient(top, #BDBBBC, #E0E0E0);
background-image: -ms-linear-gradient(top, #BDBBBC, #E0E0E0);
background-image: -o-linear-gradient(top, #BDBBBC, #E0E0E0);
background-image: linear-gradient(to bottom, #ea0, #a80);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#BDBBBC, endColorstr=#E0E0E0);
}
button.text {
color: #fc0;
background-color: #358;
border: none;
padding: 0 1.5em 0 1.5em;
margin: 0;
font-size: 0.9em;
vertical-align: middle;
}
button.text:hover{
text-decoration: underline;
cursor: pointer;
}
button.text:active{
text-decoration: underline;
cursor: pointer;
}
textarea {
font-family: mono, courier, fixed, serif;
position: relative;
float: left;
clear: left;
border: 0.1px solid #AAA;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
width: 31em;
font-size: 1em;
-webkit-box-shadow: #DDD 0px 2px 2px ;
-moz-box-shadow: #DDD 0px 2px 2px ;
box-shadow: #DDD 0px 2px 2px ;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-shadow: 0px 2px 2px rgba(255,255,255,1);
color: #4A4A4A;
background-color: #EEE;
background-image: -webkit-gradient(linear, left top, left bottom, from(#EEE), to(#FFF));
background-image: -webkit-linear-gradient(top, #EEE, #FFF);
background-image: -moz-linear-gradient(top, #EEE, #FFF);
background-image: -ms-linear-gradient(top, #EEE, #FFF);
background-image: -o-linear-gradient(top, #EEE, #FFF);
background-image: linear-gradient(to bottom, #EEE, #FFF);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#EEE, endColorstr=#FFF);
}
input {
font-family: mono, courier, fixed, serif;
position: relative;
float: left;
clear: left;
border: 0.1px solid #AAA;
padding: 0.5em;
margin: 0.5em 0 0.5em 0;
width: 31em;
font-size: 1em;
-webkit-box-shadow: #DDD 0px 2px 2px ;
-moz-box-shadow: #DDD 0px 2px 2px ;
box-shadow: #DDD 0px 2px 2px ;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-shadow: 0px 2px 2px rgba(255,255,255,1);
color: #4A4A4A;
background-color: #EEE;
background-image: -webkit-gradient(linear, left top, left bottom, from(#EEE), to(#FFF));
background-image: -webkit-linear-gradient(top, #EEE, #FFF);
background-image: -moz-linear-gradient(top, #EEE, #FFF);
background-image: -ms-linear-gradient(top, #EEE, #FFF);
background-image: -o-linear-gradient(top, #EEE, #FFF);
background-image: linear-gradient(to bottom, #EEE, #FFF);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#EEE, endColorstr=#FFF);
}
textarea.url {
height: 1.5em;
font-size: 1em;
}
input.phrase {
height: 2.5em;
font-size: 1em;
}
textarea.password {
height: 1.2em;
font-size: 1.6em;
width: 19em; /* Who had that great idea to multiply the css font size with the css width before displaying?? Anyway, 20em*1.6em=32em in the other divs. (Not even the units match, it should be em^2 :) */
}
textarea.progress {
height: 30em;
font-size: 0.5em;
width: 64em; /* = 32em, see above. */
}
div.banner_top {
margin-bottom: 0em;
padding: 0 0 0 0;
font-family: verdana, arial, sansserif;
position: relative;
display: flex;
clear: left;
height: 2.5em;
width: 100vw;
color: #fc0;
background-color: #358;
justify-content: center;
white-space: normal;
vertical-align: top;
text-align: middle;
}
div.banner_bottom {
margin-bottom: 1em;
padding: 0 0 0.2em 0;
font-family: verdana, arial, sansserif;
position: relative;
display: flex;
clear: left;
height: 1.2em;
width: 100vw;
color: #fc0;
background-color: #358;
-webkit-box-shadow: #999 0px 4px 4px ;
-moz-box-shadow: #999 0px 4px 4px ;
box-shadow: #999 0px 4px 4px ;
justify-content: center;
white-space: normal;
vertical-align: top;
text-align: middle;
}
div.block {
margin: auto;
padding: 0;
font-family: verdana, arial, sansserif;
position: relative;
clear: left;
width: 32em;
white-space: normal;
vertical-align: top;
text-align: middle;
}
div.extra_buttons {
height: 4em;
width: 32em;
padding: 0;
}
div.password_buttons {
height: 8em;
width: 32em;
padding: 0;
}
div.help {
position: absolute;
top: 10vh;
left: 0;
right: 0;
width: 40em;
margin: auto;
display:none;
border: 0.1px solid #CCCCCC;
padding: 1.5vw;
font-size: 1em;
line-height: 1.5em;
-webkit-box-shadow: #000 0px 0px 400px ;
-moz-box-shadow: #000 0px 0px 400px ;
box-shadow: #000 0px 0px 400px ;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
text-shadow: 0px 2px 2px rgba(255,255,255,1);
color: #4A4A4A;
background-color: #F7F5F6;
background-image: -webkit-gradient(linear, left top, left bottom, from(#EEEEEE), to(#FEFEFE));
background-image: -webkit-linear-gradient(top, #EEEEEE, #FEFEFE);
background-image: -moz-linear-gradient(top, #EEEEEE, #FEFEFE);
background-image: -ms-linear-gradient(top, #EEEEEE, #FEFEFE);
background-image: -o-linear-gradient(top, #EEEEEE, #FEFEFE);
background-image: linear-gradient(to bottom, #EEEEEE, #FEFEFE);
filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr=#EEEEEE, endColorstr=#FEFEFE);
}
</style>
<script type="text/javascript">
<!--
//__________________________________________________________________________________
// initialise character dictionary
//
function Dict74()
{
this.dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,:;+*-/()'\"";
}
//__________________________________________________________________________________
// create a number array that represents a word, base74
//
Dict74.prototype.code = function(word)
{
result = [];
for (var i=0; i<word.length; i++)
result.push( this.dict.indexOf( word[i] ) );
return result;
}
//__________________________________________________________________________________
// create a character word from a number array, base74
//
Dict74.prototype.decode = function(array)
{
result = "";
for (var i=0; i<array.length; i++)
result += this.dict[array[i]];
return result;
}
//__________________________________________________________________________________
// create a character word from a number array, base74
//
Dict74.prototype.decodeUnrestricted = function(array)
{
result = "";
for (var i=0; i<array.length; i++)
result += this.dict[array[i]%74];
return result;
}
//__________________________________________________________________________________
// display an array as mod74 to nicer display
//
function toString74(array)
{
var result = "";
for (var i=0; i<array.length; i++)
result += (array[i]%74).toString().padStart(3, ' ');
return result;
}
//__________________________________________________________________________________
// initialise character dictionary
//
function Dict256()
{
// This dictionalry is created such that
// • all 256 integers get a result,
// • upper-case letters, lower-case letters, numbers, and special character get the same probability,
// • letters with a slightly higher probability (we cannot give even probability to each) are those letters that are least likely to occur in English texts, according to Wikipedia,
// • only special characters that are allowed by the main large services are in.
// (Okay, this keeps changing, and is *really* annoying. Bloody hell Paypal, really?
// Doing this user-selectable is worse though, then you have to remember your settings per page.)
this.dict = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZZQJXKVBPYGFWMUCMabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzzqjxkvbpygfwmucM012345678901234567890123456789012345678901234567890123456789!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()!@#$%^&*()";
}
//__________________________________________________________________________________
// create a number array that represents a word, base74
//
Dict256.prototype.code = function(word)
{
result = [];
for (var i=0; i<word.length; i++)
result.push( this.dict.indexOf( word[i] ) );
return result;
}
//__________________________________________________________________________________
// create a character word from a number array, base74
//
Dict256.prototype.decode = function(array, end)
{
result = "";
for (var i=0; i<end; i++)
result += this.dict[array[i]];
return result;
}
//__________________________________________________________________________________
// output a number array to string, nicely aligned
//
function toString(array)
{
result = "";
for (var i=0; i<array.length; i++)
if (array[i] < 0)
result += " .";
else if (array[i] < 10)
result += " " + array[i].toString();
else
result += " " + array[i].toString();
return result;
}
//__________________________________________________________________________________
// global dictionary instances
//
var _dict74 = new Dict74();
var _dict256 = new Dict256();
//__________________________________________________________________________________
// expand a word to have the required number of letters by repeating it
//
function expand(word, letters)
{
result = "";
for (i=0, w=0; i<letters; i++, w++) {
if (w >= word.length)
w = 0;
result += word[w];
}
return result;
}
//__________________________________________________________________________________
// combine two words.
// The character i of the result is computed the following way:
// Version 1:
// the weighted sum of characters of the first word is computed by multiplying
// each character j of the first word with the index distance i-j to the current
// character. This weighted sum is added to the character i
// of the second word, then the whole array is sorted by size to destroy any matrix relations (version 2 only)
// then modulo 74 is taken (we only use 74 different characters).
// example: first word: 0,1,2,3,4; second word; 4,3,2,1,0; character to calculate: i=1.
// first word: 0 1 2 3 4
// weights: 1 0 1 2 3
// char*weights: 0 0 2 6 12 (1*0, 0*1, 1*2, 2*3, 3*4)
// sum: . 20 . . . (2 + 6 + 12)
// second word: 4 3 2 1 0
// product: . 23 . . . (20 + 3)
//
// Version 2:
// The characters a,b,c,d from places i,j from the first, and second word are combined by the operation (a*b] + 2 mod a + b +2 ^ |i-j.
// we want to avoid Matrix multiplication, in particular if we're always multiplying with the same matrix (as in version 1).
//
// Version 3:
// The browser's inbuilt secure hash function "SHA-512" is used.
// helper function creating a hash using the browser's subtle crypto API (Version 3)
async function createHash(message, method) {
const encoder = new TextEncoder();
const u8array = encoder.encode(message);
const hash = await window.crypto.subtle.digest(method, u8array);
return hash;
}
// main function (Versions 1 and 2)
function combine(first, second, n)
{
result = [];
if (document.getElementById('version').value == '2') {
for (var i=0; i<n; i++) {
var char = 0;
for (var j=0; j<n; j++) {
char += ((first[j]*second[i] + 2) % (first[i] + second[j] + 2)) ** (Math.abs(i-j) % 7); // We cannot use too high powers, otherwise we need BigInt
}
result.push(char);
}
} else {
for (var i=0; i<n; i++) {
var char = second[i];
for (var j=0; j<n; j++) {
char += first[j] * Math.abs(i-j);
}
char = Math.abs(char) % 74;
result.push(char);
}
}
return result;
}
function shuffleChar(arr) {
if (document.getElementById('version').value == '2') {
arr.sort();
for (var i=0; i<arr.length; i++) {
arr[i] = Math.abs(arr[i]) % 74;
}
}
return arr;
}
//__________________________________________________________________________________
// shuffle the keywords, using the characters in the first word as a guide.
// e.g. first word = "cbad" -> would be sorted to "abcd", and lead to the word order
// 1234 3214
// being re-arranged as 1->3, 2->2, 3->1, 4->4.
// This is on order to prevent attacks that guess the initial word (the URL/service)
// and summarise the resulting operations into one step.
// If the number of words is larger than the number of characters in the first word,
// subsequent letters "A,B,C,D,..." are assumed.
// helper function for sorting, used as a callback
function sortByLetterAndPlace(a, b) // simple helper function to sort an array of arrays first by the first value, then by the second value of its member arrays
{
if (a[0] != b[0])
return a[0] - b[0];
else
return a[1] - b[1];
}
// main function
function shuffle(words)
{
// this is new in version 2
var newWords;
if (document.getElementById('version').value == '2') {
// reorder letters of first wird and remember old order in array "reorder"
reorder = [];
for (var i=0; i<words.length; i++) {
if (i<words[0].length)
reorder.push( [_dict74.code(words[0][i]), i] );
else
reorder.push( [i - words[0].length, i] );
}
reorder.sort(sortByLetterAndPlace);
// use array "reorder" to reorder all words
newWords = [];
for (var i=0; i<words.length; i++) {
newWords.push( words[reorder[i][1]] );
}
}
else {
newWords = words;
}
return newWords;
}
//__________________________________________________________________________________
// complete calculation
//
// helper function for updating fields after the hash has been calculated, used as a callback
function updateFields(digestBuffer, n, method) {
const encoder = new TextDecoder();
var data = new Uint8Array(digestBuffer);
showPassword(_dict256.decode(data, n), "Calculated using " + method + ". Hash in bytes:\n" + data.toString());
}
// helper function to show password and details in GUI
function showPassword(password, details)
{
document.getElementById("progress").value = details;
document.getElementById("password").value = password;
document.getElementById("password").focus();
document.getElementById("password").select();
}
// main function
function calculate(n, shaMethod)
{
// read from source field
url = document.getElementById("url").value.trim();
url = url.replace(/ /g,'');
if (url==='')
url = ".";
words = document.getElementById("phrase").value.trim();
if (document.getElementById('version').value=='2' || document.getElementById('version').value=='1') {
if (words === '')
words = ". . . . .";
words = words.split(' ');
words = [url].concat(words)
// shuffle words
words = shuffle(words);
if (document.getElementById('version').value=='2')
words = words.concat("."); // adding a last step of 62 ('k') (half the dictionary) for an additional weighted sum
else
words = words.concat("A"); // adding a last step of zeros ('A') for an additional weighted sum
// expand entries
for (var i=0; i<words.length; i++)
words[i] = expand(words[i], n);
// write into target field
string = "";
combineStr = words[0];
combineArr = _dict74.code(combineStr);
for (var w=1; w<words.length; w++) {
wordStr = words[w];
wordArr = _dict74.code(wordStr);
string += "first: " + combineStr + " " + toString74(combineArr) + "\n";
string += "second: " + wordStr + " " + toString74(wordArr) + "\n";
// in version 2, the combined string here is not mod74, because we want to display it before shuffling, just to check.
combineArr = combine(combineArr, wordArr, n);
combineStr = _dict74.decodeUnrestricted(combineArr);
string += "combined: " + combineStr + " " + toString74(combineArr) + "\n";
combineArr = shuffleChar(combineArr);
combineStr = _dict74.decodeUnrestricted(combineArr);
string += "shuffled: " + combineStr + " " + toString74(combineArr) + "\n";
string += "\n";
}
showPassword(combineStr, string);
}
else {
var promise = createHash(url + ' ' + words, shaMethod);
var result = promise.then((buffer) => updateFields(buffer, n, shaMethod));
}
}
//__________________________________________________________________________________
// clear the contents of one or all text fields
//
function clearData(id)
{
if (id==='all') {
clearData("url");
clearData("phrase");
clearData("progress");
clearData("password");
}
else
document.getElementById(id).value = "";
}
//__________________________________________________________________________________
// copy the password to the clipboard
// this only works offline -- I'll leave it in until I find a solution to use it
function clipboard() {
document.getElementById("password").focus();
document.getElementById("password").select();
document.getElementById("password").setSelectionRange(0, 99999);
navigator.clipboard.writeText(document.getElementById("password").value);
document.getElementById("clipboard").focus();
}
//__________________________________________________________________________________
// shows or hides the passphrase
//
function showhide() {
var phrase = document.getElementById("phrase");
if (phrase.type === "password") {
phrase.type = "text";
document.getElementById("showhide").innerHTML = "Hide Passphrase";
} else {
phrase.type = "password";
document.getElementById("showhide").innerHTML = "Show Passphrase";
}
}
//-->
</script>
</head>
<body>
<div class="banner_top">
<div>
<h1>Unique passwords for all your accounts. With one single passphrase.</h1>
</div>
</div>
<div class="banner_bottom">
<button class="text" onclick="document.getElementById('help_why').style.display='block';">Why <i>pass-word.info</i></button> |
<button class="text" onclick="document.getElementById('help_how').style.display='block';">How to Use</button> |
<button class="text" onclick="document.getElementById('help_works').style.display='block';">How it Works</button> |
<button class="text" onclick="document.getElementById('help_free').style.display='block';">Why it's free</button>
</div>
<div class="block">
<textarea id="url" class="url" wrap="hard" rows="1" placeholder="Type website/account name here" onfocus="clearData('url')"></textarea>
<input type="password" id="phrase" class="phrase" wrap="hard" rows= "4" placeholder="Type secret passphrase here" onfocus="clearData('phrase')"></textarea>
</div>
<br/>
<div class="block extra_buttons">
<button id="showhide" class="large" onClick="showhide()">Show Passphrase</button>
<button class="large" onClick="clearData('all')">Clear Data</button>
</div>
<br/>
<div class="block">
<textarea id="password" class="password" wrap="hard" placeholder="Secure unique password" rows="1"></textarea><br/>
</div>
<br/>
<div class="block password_buttons">
<select id="version"><option value="1">Algorithm version 1, before 2024-07-10 (proven unsafe)</option><option value="2">Algorithm version 2 (experimental)</option><option value="3" selected>SHA-2 (please replace your old passwords)</option></option></select>
<button class="large" onClick="calculate(8, 'SHA-256')">8 Character Password</button>
<button class="large" onClick="calculate(10, 'SHA-256')">10 Character Password</button>
<button class="large" onClick="calculate(15, 'SHA-256')">15 Character Password</button>
<button class="large" onClick="calculate(23, 'SHA-256')">23 Character Password</button>
<button class="large" onClick="calculate(32, 'SHA-384')">32 Character Password</button>
<button class="large" onClick="calculate(64, 'SHA-512')">64 Character Password</button>
</div>
<div class="block">
<textarea id="progress" class="progress" wrap="hard" placeholder="Calculation details here" rows="200"></textarea>
</div>
<div id="help_why" class="help">
<h3>You must not re-use passwords.</h3>
If you are using the same password for different websites, anybody who gets hold of your password can login to other sites using your account.<br/>
This tool creates a unique password for each of your websites.<br/>
All it needs is the website's name and a passphrase.<br/>
All you need is one single passphrase for all your accounts.<br/>
Please note that versions 1 and 2 the algorithm are probably not safe, use SHA-2 only.<br/><br/>
<button class="large" onclick="document.getElementById('help_why').style.display='none';" style="width: 20vw;">OK</button>
<br/><br/>
</div>
<div id="help_how" class="help">
<h3>Instructions</h3>
▶ Type the website into the top left field.<br/><br/>
▶ Type your passphrase into the field below. Use the same passphrase for all your accounts. Use something that's easy to remember, but contains four words or more. Remember it. Never write it down anywhere.<br/><br/>
▶ Click one of the buttons to create a password.<br/><br/>
▶ Your password will be displayed below. Copy and paste it into the website. Some calculation details are displayed in the bottom right field.<br/><br/>
▶ Remove the data from your browser to prevent a bystander from reading your password (press button <i>Clear Data</i> or click into the passphrase field or hit Ctrl+F5).<br/><br/>
<button class="large" onclick="document.getElementById('help_how').style.display='none';" style="width: 20vw;">OK</button>
<br/><br/>
</div>
<div id="help_works" class="help">
<h3>How does this work?</h3>
Each generated password is unique for the website and the passphrase.<br/>
Technically, the passphrase is split up into words, then the website name
is combined with these words in a series of multiply, add and modulo operations.
Every single character in the passphrase influences all characters in the resulting password.<br/>
One leaked password does not put all your other passwords in danger, and your other accounts are safe.<br/><br/>
All mathematical operations are executed in your browser.<br/>
Nothing is stored on the web. No cookies are read or written.<br/>
The source code is entirely inside this page, nothing is loaded from external sources.<br/>
To check you may right-click and select "show page source".<br/><br/>
(The algorithms 1 and 2 are experimental, please use at your own risk. SHA-2 is a known security function, please use this for normal use)
If you would like to attack algorithm 2 and show what you did, please email me or leave a comment on github. Algorithm 1 has already been defeated.)<br/><br/>
<button class="large" onclick="document.getElementById('help_works').style.display='none';" style="width: 20vw;">OK</button>
<br/><br/>
</div>
<div id="help_free" class="help">
<h3>Why is this service free?</h3>
This meant to be a secure password generation service.<br/>
In order to be secure, no data must travel between your computer and the internet.<br/>
All commercialisation technologies that exist need to read data from you computer, either for advertising, recording clicks, or license checks.<br/>
Since this should be a secure service, it therefore must be free. <br/><br/>
<button class="large" onclick="document.getElementById('help_free').style.display='none';" style="width: 20vw;">OK</button>
<br/><br/>
</div>
</body>
</html>