@@ -184,11 +184,17 @@ function generate_diceware(wordlist) {
184184 var pass_length = document . getElementById ( 'diceware-length' ) ;
185185 var pass_entropy = document . getElementById ( 'diceware-entropy' ) ;
186186 var hyphens = document . getElementById ( 'hyphen8_1' ) ;
187+
187188 pass = generate_pass ( len , wordlist , true ) ;
188189 pass_id . innerHTML = pass ;
190+
191+ if ( hyphens . checked ) {
192+ pass = pass . split ( ' ' ) . join ( '-' ) ;
193+ pass_id . innerHTML = pass ;
194+ }
195+
189196 pass_length . innerHTML = "<span>" + pass . replace ( / \s / g, '' ) . length + "</span>" + " characters." ;
190197 pass_entropy . innerHTML = "~" + Math . floor ( len * Math . log2 ( wordlist . length ) ) + "-bits." ;
191- if ( hyphens . checked ) pass_id . innerHTML = pass . split ( ' ' ) . join ( '-' ) ;
192198}
193199
194200function generate_eff ( wordlist ) {
@@ -198,11 +204,17 @@ function generate_eff(wordlist) {
198204 var pass_length = document . getElementById ( 'eff-length' ) ;
199205 var pass_entropy = document . getElementById ( 'eff-entropy' ) ;
200206 var hyphens = document . getElementById ( 'hyphen8_2' ) ;
207+
201208 pass = generate_pass ( len , wordlist , true ) ;
202209 pass_id . innerHTML = pass ;
210+
211+ if ( hyphens . checked ) {
212+ pass = pass . split ( ' ' ) . join ( '-' ) ;
213+ pass_id . innerHTML = pass ;
214+ }
215+
203216 pass_length . innerHTML = "<span>" + pass . replace ( / \s / g, '' ) . length + "</span>" + " characters." ;
204217 pass_entropy . innerHTML = "~" + Math . floor ( len * Math . log2 ( wordlist . length ) ) + "-bits." ;
205- if ( hyphens . checked ) pass_id . innerHTML = pass . split ( ' ' ) . join ( '-' ) ;
206218}
207219
208220function generate_alternate ( wordlist ) {
@@ -214,9 +226,14 @@ function generate_alternate(wordlist) {
214226 var hyphens = document . getElementById ( 'hyphen8_3' ) ;
215227 pass = generate_pass ( len , wordlist , true ) ;
216228 pass_id . innerHTML = pass ;
229+
230+ if ( hyphens . checked ) {
231+ pass = pass . split ( ' ' ) . join ( '-' ) ;
232+ pass_id . innerHTML = pass ;
233+ }
234+
217235 pass_length . innerHTML = "<span>" + pass . replace ( / \s / g, '' ) . length + "</span>" + " characters." ;
218236 pass_entropy . innerHTML = "~" + Math . floor ( len * Math . log2 ( wordlist . length ) ) + "-bits." ;
219- if ( hyphens . checked ) pass_id . innerHTML = pass . split ( ' ' ) . join ( '-' ) ;
220237}
221238
222239function generate_ninja ( ) {
0 commit comments