-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.html
More file actions
253 lines (228 loc) · 10.2 KB
/
Copy pathbase.html
File metadata and controls
253 lines (228 loc) · 10.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Password Generator Generator</title>
<link rel="stylesheet" href="./src/style/main.css"/>
<link rel="stylesheet" href="./src/style/katex.css"/>
</head>
<body>
<include-html src="./src/components/wc-tab-panel.html"></include-html>
<main>
<noscript>
JavaScript required to generate any generators, with the one and only
</noscript>
<header>
<h1>
Password Generator Generator
</h1>
<a href="https://github.com/siverv/password-generator-generator" class="github-link">
GitHub
</a>
<h2>State machines and symbolic dynamics and entropy, oh my!</h2>
</header>
<section class="specification-section">
<wc-tab-panel id="specification-panel" search-param="main-tabs">
<h3 slot="tab">
generator generator
</h3>
<section slot="content">
<label>
Presets:
<select id="predefinedSelect">
</select>
</label>
<div>
<textarea id="specification" name="specification">
</textarea>
</div>
<div>
<button type="submit" id="run">
Generate Generator
</button>
<pre id="error-log">
</pre>
</div>
</section>
<h3 slot="tab">
about
</h3>
<section slot="content" class="markdown">
<include-markdown src="./README.md"></include-markdown>
</section>
<h3 slot="tab">
theory
</h3>
<section slot="content" class="markdown math">
<button id="initialize-katex">
Load the KaTeX library for better math rendering (external script from jsdelivr.net)
</button>
<include-markdown src="./THEORY.md"></include-markdown>
</section>
</wc-tab-panel>
</section>
<section class="analyzation-section">
<wc-tab-panel search-param="aside-tabs">
<h3 slot="tab">
output
</h3>
<section slot="content">
<fieldset>
<legend>
Entropy
</legend>
<div>
<ul>
<li>
The bits of entropy for this generator is approximately <strong id="entropy-bits">???</strong> per token
</li>
<li>
This is about equivalent to standard random password with a choice of <strong id="entropy-equiv">???</strong> characters
</li>
<li>
To achieve a proper attack-secure entropy for passwords (~128 bits of entropy), you should use at least <strong id="entropy-length">???</strong> tokens from the generator.
</li>
</ul>
</div>
</fieldset>
<fieldset>
<legend>
Sample
<button id="refresh-sample">
⟳
</button>
</legend>
<pre id="sample-output">
</pre>
</fieldset>
<fieldset class="generator-settings">
<legend>
Generator Settings
</legend>
<label>
Password length (number of tokens)
<input id="desired-length" type="number" min="1" step="1" max="2000">
</label>
<p>- or -</p>
<label>
Bits of Entropy
<input id="desired-bits" type="number" min="1" step="1" max="2000">
</label>
</fieldset>
<wc-tab-panel selectedIndex="3" search-param="output-tabs">
<h4 slot="tab">JavaScript</h4>
<div slot="content" class="code-with-copy">
<textarea class="code" id="gen-jsfn"></textarea>
<button class="copy-preceding-text">
Copy
</button>
</div>
<h4 slot="tab">Bookmarklet</h4>
<div slot="content" class="code-with-copy">
<textarea class="code compact" id="gen-book"></textarea>
<button class="copy-preceding-text">
Copy
</button>
<a href="#" id="gen-book-link">
Generate Password
</a>
</div>
<h4 slot="tab">HTML</h4>
<div slot="content" class="code-with-copy">
<textarea class="code" id="gen-html"></textarea>
<button class="copy-preceding-text">
Copy
</button>
<div id="gen-html-show">
</div>
<!-- <div>
<button id="gen-html-replace-page" disabled>
Replace current page with this html
</button>
</div> -->
</div>
<h4 slot="tab">Data-URI</h4>
<div slot="content" class="code-with-copy">
<textarea class="code compact" id="gen-data"></textarea>
<button class="copy-preceding-text">
Copy
</button>
<a target="_blank" href="#" id="gen-data-link">
Link to Password Generator
</a>
</div>
</wc-tab-panel>
</section>
<h3 slot="tab">
visualization
</h3>
<section slot="content">
<fieldset>
<legend>Graphviz</legend>
<div id="states-viz">
<button id="initialize-graphviz">
Load Graphviz library for visualization (external script from jsdelivr)
</button>
</div>
</fieldset>
<fieldset>
<legend>Dot-diagram</legend>
<pre id="states-dot"></pre>
</fieldset>
</section>
</wc-tab-panel>
</section>
<footer>
<p>
<a href="https://github.com/siverv/">siverv</a> 2021
</p>
</footer>
</main>
<script type="module" src="./src/index.js"></script>
</body>
<template id="graphviz-scripts">
<script src="https://cdn.jsdelivr.net/npm/@hpcc-js/wasm/dist/index.min.js"></script>
</template>
<template id="katex-scripts">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.css" integrity="sha384-RZU/ijkSsFbcmivfdRBQDtwuwVqK7GMOw6IMvKyeWL2K5UAlyp6WonmB8m7Jd0Hn" crossorigin="anonymous">
<!-- The loading of KaTeX is deferred to speed up page rendering -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/katex.min.js" integrity="sha384-pK1WpvzWVBQiP0/GjnvRxV4mOb0oxFuyRxJlk6vVw146n3egcN5C925NCP7a7BY8" crossorigin="anonymous"></script>
<!-- To automatically render math in text elements, include the auto-render extension: -->
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.13.13/dist/contrib/auto-render.min.js" integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl" crossorigin="anonymous"></script>
</template>
<template id="password-generator-html-body">
<div class="passgen-area">
<style>
.passgen-area {
display: flex;
flex-direction: column;
max-width: 300px;
margin: auto;
}
</style>
<button id="generate">
Generate Password
</button>
<textarea id="output"></textarea>
<button id="copy">copy</button>
<script>
/*@PASSWORD_GENERATOR_GOES_HERE@*/
document.getElementById("generate").addEventListener("click", () => {
document.getElementById("output").value = newPassword();
document.getElementById("copy").innerText = "Copy"
})
document.getElementById("copy").addEventListener("click", () => {
let value = document.getElementById("output").value;
if(window.navigator.clipboard) {
window.navigator.clipboard.writeText(value);
document.getElementById("copy").innerText = "Copied!"
} else {
document.getElementById("copy").innerText = "Copying denied."
}
})
</script>
</div>
</template>
</html>