Password generator: Difference between revisions

added RPL
(Applesoft BASIC)
(added RPL)
 
(9 intermediate revisions by 6 users not shown)
Line 33:
<!-- or zed, on the other side of the pond. -->
<br><br>
 
=={{header|6502 Assembly}}==
Unfortunately, easy6502 cannot display text, but it does have a random number generator, so this example merely contains the logic for generating the password itself. The screen can only display colored pixels, and the top 4 bytes are masked off, so this is just a visual aid to show the process in action. The X register is loaded with the password's length (in this case, 20 characters, not counting the null terminator.)
<syntaxhighlight lang="6502asm">LDY #0
LDX #20
LOOP:
LDA $FE ;load a random byte
BMI LOOP ;IF GREATER THAN 7F, ROLL AGAIN
CMP #$21 ;ASCII CODE FOR !
BCC LOOP
CMP #$5C
BEQ LOOP ;NO \
CMP #$60
BEQ LOOP ;NO `
;else, must be a good character
STA $0200,Y
INY
DEX
BNE LOOP
BRK ;end program</syntaxhighlight>
 
{{out}}
Code was executed three times and generated the following passwords:
<pre>vPX[d5gUY_5lUj[bNDS1
hY+%]lM*j~1Z4YG!0X0<
v}N|4dK(b71qgi-gGwkq</pre>
 
=={{header|8086 Assembly}}==
Line 41 ⟶ 67:
Help is printed when no arguments are given.
 
<langsyntaxhighlight lang="asm"> cpu 8086
bits 16
;;; MS-DOS syscalls
Line 314 ⟶ 340:
lmask: resb 1 ; Mask for random number generation
rnddat: resb 4 ; RNG state
buffer: resb 257 ; Space to store password</langsyntaxhighlight>
 
=={{header|Action!}}==
<langsyntaxhighlight Actionlang="action!">BYTE FUNC GetNumParam(CHAR ARRAY text BYTE min,max)
BYTE res
 
Line 441 ⟶ 467:
UNTIL again=0
OD
RETURN</langsyntaxhighlight>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Password_generator.png Screenshot from Atari 8-bit computer]
Line 469 ⟶ 495:
 
=={{header|Ada}}==
<langsyntaxhighlight Adalang="ada">with Ada.Numerics.Discrete_Random;
with Ada.Strings.Fixed;
with Ada.Command_Line;
Line 660 ⟶ 686:
end loop;
 
end Mkpw;</langsyntaxhighlight>
{{out}}
<pre>$ ./mkpw count 8 length 22 safe
Line 673 ⟶ 699:
 
=={{header|Applesoft BASIC}}==
<langsyntaxhighlight Applesoftlang="applesoft">1 N=1
2 L=8
3 M$=CHR$(13)
Line 831 ⟶ 857:
900 Q = 1
910 VTAB 23
920 RETURN</langsyntaxhighlight>
=={{header|Arturo}}==
 
<langsyntaxhighlight lang="rebol">lowercase: `a`..`z`
uppercase: `A`..`Z`
digits: `0`..`9`
Line 868 ⟶ 894:
loop 1..10 'x [
print generate to :integer first arg
]</langsyntaxhighlight>
 
{{out}}
Line 886 ⟶ 912:
 
=={{header|AWK}}==
<syntaxhighlight lang="awk">
<lang AWK>
# syntax: GAWK -f PASSWORD_GENERATOR.AWK [-v mask=x] [-v xt=x]
#
Line 984 ⟶ 1,010:
printf("example: %s -v mask=%s -v xt=%s\n",cmd,mask,xt)
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 996 ⟶ 1,022:
 
=={{header|C}}==
<syntaxhighlight lang="c">
<lang c>
#include <stdio.h>
#include <stdlib.h>
Line 1,123 ⟶ 1,149:
return 0;
}
</syntaxhighlight>
</lang>
 
{{out}}
Line 1,137 ⟶ 1,163:
 
=={{header|C sharp|C#}}==
<langsyntaxhighlight lang="csharp">using System;
using System.Linq;
 
Line 1,211 ⟶ 1,237:
return new string(password);
}
}</langsyntaxhighlight>
{{out}}
<pre>PASSGEN -l:12 -c:6
Line 1,222 ⟶ 1,248:
 
=={{header|C++}}==
<langsyntaxhighlight lang="cpp">#include <iostream>
#include <string>
#include <algorithm>
Line 1,276 ⟶ 1,302:
}
return 0;
}</langsyntaxhighlight>
{{out}}
<pre>
Line 1,301 ⟶ 1,327:
<b>module.ceylon</b>:
 
<langsyntaxhighlight lang="ceylon">
module rosetta.passwordgenerator "1.0.0" {
import ceylon.random "1.2.2";
}
 
</syntaxhighlight>
</lang>
 
<b>run.ceylon:</b>
 
<langsyntaxhighlight lang="ceylon">
import ceylon.random {
DefaultRandom,
Line 1,443 ⟶ 1,469:
Character[] filterCharsToExclude(Character[] chars, Character[] charsToExclude)
=> chars.filter((char) => ! charsToExclude.contains(char)).sequence();
</syntaxhighlight>
</lang>
 
 
Line 1,483 ⟶ 1,509:
 
=={{header|Clojure}}==
<langsyntaxhighlight lang="clojure">(ns pwdgen.core
(:require [clojure.set :refer [difference]]
[clojure.tools.cli :refer [parse-opts]])
Line 1,521 ⟶ 1,547:
(if (:help options) (println summary)
(dotimes [n (:count options)]
(println (apply str (generate-password options)))))))</langsyntaxhighlight>
 
{{out}}
Line 1,545 ⟶ 1,571:
Note that on line 220, the <code>CLR</code> statement is called prior to restarting the program to avoid a <code>?REDIM'D ARRAY ERROR</code> if line 85 should execute. By default, single dimension arrays do not need to be DIMensioned if kept to 11 elements (0 through 10) or less. Line 85 checks for this.
 
<langsyntaxhighlight lang="gwbasic">1 rem password generator
2 rem rosetta code
10 g$(1)="abcdefghijklmnopqrstuvwxyz"
Line 1,607 ⟶ 1,633:
610 print "Press any key to begin."
615 get k$:if k$="" then 615
620 return</langsyntaxhighlight>
 
{{out}}
Line 1,663 ⟶ 1,689:
 
=={{header|Common Lisp}}==
<langsyntaxhighlight lang="lisp">
(defvar *lowercase* '(#\a #\b #\c #\d #\e #\f #\g #\h #\i #\j #\k #\l #\m
#\n #\o #\p #\q #\r #\s #\t #\u #\v #\w #\x #\y #\z))
Line 1,710 ⟶ 1,736:
(loop for x from 1 to count do
(print (generate-password len human-readable)))))
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 1,723 ⟶ 1,749:
 
=={{header|Crystal}}==
<langsyntaxhighlight Crystallang="crystal">require "random/secure"
 
special_chars = true
Line 1,794 ⟶ 1,820:
break if count <= 0
end
</syntaxhighlight>
</lang>
 
{{out}}
Line 1,841 ⟶ 1,867:
 
=={{header|Elixir}}==
<langsyntaxhighlight lang="elixir">defmodule Password do
@lower Enum.map(?a..?z, &to_string([&1]))
@upper Enum.map(?A..?Z, &to_string([&1]))
Line 1,879 ⟶ 1,905:
end
 
Password.generator</langsyntaxhighlight>
 
{{out}}
Line 1,896 ⟶ 1,922:
=={{header|F_Sharp|F#}}==
===The function===
<langsyntaxhighlight lang="fsharp">
// A function to generate passwords of a given length. Nigel Galloway: May 2nd., 2018
let N = (set)"qwertyuiopasdfghjklzxcvbnm"
Line 1,907 ⟶ 1,933:
let fN n = not (Set.isEmpty (Set.intersect N n )||Set.isEmpty (Set.intersect I n )||Set.isEmpty (Set.intersect G n )||Set.isEmpty (Set.intersect E n ))
Seq.initInfinite(fun _->(set)(List.init n (fun _->L.[y.Next()%(Array.length L)])))|>Seq.filter fN|>Seq.map(Set.toArray >> System.String)
</syntaxhighlight>
</lang>
===A possible use===
Print 5 password of length 8
<langsyntaxhighlight lang="fsharp">
pWords 8 |> Seq.take 5 |> Seq.iter(printfn "%s")
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 1,924 ⟶ 1,950:
=={{header|Factor}}==
{{works with|Factor|0.99 2020-01-23}}
<langsyntaxhighlight lang="factor">USING: arrays assocs combinators command-line continuations io
kernel math math.parser multiline namespaces peg.ebnf
prettyprint random sequences ;
Line 1,993 ⟶ 2,019:
[ parse-args gen-pwds ] [ 2drop usage print ] recover ;
 
MAIN: main</langsyntaxhighlight>
{{out}}
<pre>
Line 2,018 ⟶ 2,044:
 
=={{header|FreeBASIC}}==
{{trans|Run BASIC}}<langsyntaxhighlight lang="freebasic">Dim As String charS(4)
charS(1) = "0123456789"
charS(2) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
Line 2,055 ⟶ 2,081:
Wend
Sleep
</syntaxhighlight>
</lang>
{{out}}
<pre>------ Password Generator ------
Line 2,067 ⟶ 2,093:
</pre>
 
=={{header|FutureBasic}}==
This compiles as a standalone Mac application that meets all the task requirements and options. Screenshot of compiled app shows output.
<syntaxhighlight lang="futurebasic">
output file "Password Generator"
include "Tlbx GameplayKit.incl"
 
begin enum
_mApplication
_mFile
_mEdit
end enum
 
begin enum 1
_iSeparator
_iPreferences
end enum
 
begin enum
_iCreate
_iSeparator2
_iSave
_iPrint
_iSeparator4
_iClose
end enum
 
_window = 1
begin enum output 1
_passwordScroll
_passwordView
_offscreenPrintView
_optionsHelp
_checkOmitIs
_checkOmitOs
_checkOmitSs
_checkOmit2s
_charactersLongLabel
_passwordLengthField
_pwAmountLabel
_pwAmountField
_seedLabel
_seedField
_helpBtn
_bottomLine
_saveBtn
_printBtn
_createPasswordsBtn
end enum
 
_helpPopover = 2
begin enum 1
_popoverLabel
end enum
 
_savePanel = 1
_pwLenAlert = 2
 
 
void local fn BuildMenus
// application
menu _mApplication, _iSeparator
menu _mApplication, _iPreferences,, @"Preferences…", @","
// file
menu _mFile, -1,, @"File"
menu _mFile, _iCreate,, @"Create passwords", @"p"
menu _mFile, _iSeparator2
menu _mFile, _iSave,, @"Save", @"s"
menu _mFile, _iPrint,, @"Print", @"p"
menu _mFile, _iSeparator4
menu _mFile, _iClose,, @"Close", @"w"
MenuItemSetAction( _mFile, _iClose, @"performClose:" )
editmenu _mEdit
end fn
 
void local fn BuildWindow
long tag
CGRect r = fn CGRectMake( 0, 0, 672, 460 )
window _window, @"Rosetta Code Password Generator", r//, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
WindowSetContentMinSize( _window, fn CGSizeMake(310,386) )
r = fn CGRectMake( 20, 73, 515, 370 )
scrollview _passwordScroll, r, NSLineBorder,,_window
ViewSetAutoresizingMask( _passwordScroll, NSViewWidthSizable + NSViewHeightSizable )
textview _passwordView, r, _passwordScroll,, _window
TextViewSetTextContainerInset( _passwordView, fn CGSizeMake( 10, 15 ) )
TextSetFontWithName( _passwordView, @"Menlo", 13.0 )
r = fn CGRectMake( -600, -600, 450, 405 )
textview _offscreenPrintView, r,,, _window
TextSetFontWithName( _offscreenPrintView, @"Menlo", 13.0 )
TextSetColor( _offscreenPrintView, fn ColorBlack )
TextViewSetBackgroundColor( _offscreenPrintView, fn ColorWhite )
r = fn CGRectMake( 547, 424, 60, 16 )
textlabel _optionsHelp, @"Exclude:", r, _window
r = fn CGRectMake( 607, 425, 41, 14 )
button _checkOmitIs, YES, NSControlStateValueOff, @"Il1", r, NSButtonTypeSwitch
ViewSetToolTip( _checkOmitIs, @"Omit similar characters I, l and 1." )
r = fn CGRectOffset( r, 0, -24 )
button _checkOmitOs, YES ,NSControlStateValueOff, @"O0", r, NSButtonTypeSwitch
ViewSetToolTip( _checkOmitOs, @"Omit similar characters O and 0." )
r = fn CGRectOffset( r, 0, -24 )
button _checkOmitSs, YES, NSControlStateValueOff, @"5S", r, NSButtonTypeSwitch
ViewSetToolTip( _checkOmitSs, @"Omit similar characters 5 and S." )
r = fn CGRectOffset( r, 0, -24 )
button _checkOmit2s, YES, NSControlStateValueOff, @"2Z", r, NSButtonTypeSwitch
ViewSetToolTip( _checkOmit2s, @"Omit similar characters 2 and Z." )
r = fn CGRectMake( 549, 322, 103, 16 )
textlabel _charactersLongLabel, @"Chars (4-50)", r, _window
r = fn CGRectMake( 549, 298, 103, 21 )
textfield _passwordLengthField, YES, @"25", r,_window
TextFieldSetBordered( _passwordLengthField, YES )
ControlSetAlignment(_passwordLengthField, NSTextAlignmentCenter )
ControlSetFormat( _passwordLengthField, @"0123456789", YES, 2, 0 )
ViewSetToolTip( _passwordLengthField, @"Set password length from 4 to 50." )
r = fn CGRectMake( 549, 263, 103, 16 )
textlabel _pwAmountLabel, @"Passwords:", r, _window
r = fn CGRectMake( 549, 240, 103, 21 )
textfield _pwAmountField, YES, @"100", r,_window
TextFieldSetBordered( _pwAmountField, YES )
ControlSetAlignment( _pwAmountField, NSTextAlignmentCenter )
ControlSetFormat( _pwAmountField, @"0123456789", YES, 4, 0 )
ViewSetToolTip( _pwAmountField, @"Enter number of passwords to generate." )
r = fn CGRectMake( 549, 205, 103, 16 )
textlabel _seedLabel, @"Seed value:", r, _window
r = fn CGRectMake( 549, 182, 103, 21 )
textfield _seedField, YES, , r,_window
TextFieldSetBordered( _seedField, YES )
ControlSetAlignment(_seedField, NSTextAlignmentCenter )
ControlSetFormat( _seedField, @"0123456789", YES, 6, 0 )
ViewSetToolTip( _seedField, @"Enter optional random seed number." )
for tag = _optionsHelp to _seedField
ViewSetAutoresizingMask( tag, NSViewMinXMargin + NSViewMinYMargin )
next
r = fn CGRectMake( 631, 70, 25, 25 )
button _helpBtn, YES,,, r, NSButtonTypeMomentaryLight, NSBezelStyleHelpButton, _window
ViewSetToolTip( _helpBtn, @"Click for application help instructions." )
ViewSetAutoresizingMask( _helpBtn, NSViewMinXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 20, 55, 632, 5 )
box _bottomline,, r, NSBoxSeparator
ViewSetAutoresizingMask( _bottomline, NSViewWidthSizable + NSViewMaxYMargin )
r = fn CGRectMake( 20, 15, 62, 32 )
button _printBtn, YES, , @"Print…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _printBtn, NSViewMaxXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 91, 15, 62, 32 )
button _saveBtn, YES, , @"Save…", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _saveBtn, NSViewMaxXMargin + NSViewMaxYMargin )
r = fn CGRectMake( 522, 15, 131, 32 )
button _createPasswordsBtn, YES, , @"Create passwords", r, NSButtonTypeMomentaryLight, NSBezelStyleRegularSquare, _window
ViewSetAutoresizingMask( _createPasswordsBtn, NSViewMinXMargin + NSViewMaxYMargin )
end fn
 
void local fn BuildPopover
CFStringRef helpText = @"This application generates randomized passwords from 4 to 50 characters in length. "
helpText = fn StringByAppendingString( helpText, @"Theoretically, the number generated is limited only by system memory.\n\n" )
helpText = fn StringByAppendingString( helpText, @"Passwords will contain at least one each of the following character types:\n" )
helpText = fn StringByAppendingString( helpText, @"\tLowercase letters\t\t: a -> z\n" )
helpText = fn StringByAppendingString( helpText, @"\tUppercase letters\t\t: A -> Z\n" )
helpText = fn StringByAppendingString( helpText, @"\tNumbers\t\t\t\t: 0 -> 9\n" )
helpText = fn StringByAppendingString( helpText, @"\tSpecial characters\t: !\"#$%&'()*+,-./:;<=>?@[]^_{|}~\n\n" )
helpText = fn StringByAppendingString( helpText, @"You can use checkboxes to exclude visually similar characters: Il1 O0 5S 2Z.\n\n" )
helpText = fn StringByAppendingString( helpText, @"This application offers two automatic levels of randomization. However you are " )
helpText = fn StringByAppendingString( helpText, @"welcome to enter a custom randomizer seed number in the box provided.\n\n" )
helpText = fn StringByAppendingString( helpText, @"Passwords can be copied to the pasteboard, saved to a text file, or printed." )
popover _helpPopover, (0,0,395,365), NSPopoverBehaviorTransient
textlabel _popoverLabel, helpText, (10,10,375,345)
end fn
 
void local fn OutOfBoundsAlert
CFStringRef alertStr = @"Passwords must be at least four characters long, but no more than 50 characters."
alert -_pwLenAlert,, @"Password length is out of bounds", alertStr, @"Okay", YES
AlertButtonSetKeyEquivalent( _pwLenAlert, 1, @"\e" )
AlertSetStyle( _pwLenAlert, NSAlertStyleWarning )
alert _pwLenAlert
end fn
 
 
local fn BuildPassword as CFStringRef
long i
CFArrayRef charArr = fn AppProperty( @"charArray" )
CFStringRef numbers = charArr[0]
CFStringRef uppercase = charArr[1]
CFStringRef lowercase = charArr[2]
CFStringRef symbols = charArr[3]
// Omit confusing letters selected by user, if any
if ( fn ButtonState( _checkOmitIs ) == NSControlStateValueOn )
numbers = fn StringByReplacingOccurrencesOfString( numbers, @"1", @"" )
uppercase = fn StringByReplacingOccurrencesOfString( uppercase, @"I", @"" )
lowercase = fn StringByReplacingOccurrencesOfString( lowercase, @"l", @"" )
end if
if ( fn ButtonState( _checkOmitOs ) == NSControlStateValueOn )
numbers = fn StringByReplacingOccurrencesOfString( numbers, @"0", @"" )
uppercase = fn StringByReplacingOccurrencesOfString( uppercase, @"O", @"" )
end if
if( fn ButtonState( _checkOmitSs ) == NSControlStateValueOn )
numbers = fn StringByReplacingOccurrencesOfString( numbers, @"5", @"" )
uppercase = fn StringByReplacingOccurrencesOfString( uppercase, @"S", @"" )
end if
if ( fn ButtonState( _checkOmit2s ) == NSControlStateValueOn )
numbers = fn StringByReplacingOccurrencesOfString( numbers, @"2", @"" )
uppercase = fn StringByReplacingOccurrencesOfString( uppercase, @"Z", @"" )
end if
// Build string pool from other character sets
CFStringRef allChars = fn StringWithFormat( @"%@%@%@%@", numbers, uppercase, lowercase, symbols )
// Begin construction password string with single random character from each character set
randomize
CFMutableStringRef pwStr = fn MutableStringWithCapacity(0)
CFStringRef rndNumberChar = fn StringWithFormat( @"%c", fn StringCharacterAtindex( numbers, rnd( len( numbers ) -1 ) ) )
CFStringRef rndUCaseChar = fn StringWithFormat( @"%c", fn StringCharacterAtindex( uppercase, rnd( len( uppercase ) -1 ) ) )
CFStringRef rndLCaseChar = fn StringWithFormat( @"%c", fn StringCharacterAtindex( lowercase, rnd( len( lowercase ) -1 ) ) )
CFStringRef rndSymbolChar = fn StringWithFormat( @"%c", fn StringCharacterAtindex( symbols, rnd( len( symbols ) -1 ) ) )
// Add first four randomized characters to password string
MutableStringAppendString( pwStr, fn StringWithFormat( @"%@%@%@%@", rndNumberChar, rndUCaseChar, rndLCaseChar, rndSymbolChar ) )
// Build array of characters for shuffling
CFMutableArrayRef mutArr = fn MutableArrayWithCapacity(0)
for i = 0 to len(allChars) - 1
unichar tempUni = fn StringCharacterAtIndex( allChars, i )
CFStringRef s = fn StringWithFormat( @"%c", tempUni )
MutableArrayInsertObjectAtIndex( mutArr, s, i )
next
// Shuffle character array for randomness
CFArrayRef rndStrArr = fn GKRandomSourceArrayByShufflingObjectsInArray( fn GKRandomSourceInit, mutArr )
CFStringRef rndStr = fn ArrayComponentsJoinedByString( rndStrArr, @"" )
long pwLength = fn StringIntegerValue( fn ControlStringValue( _passwordLengthField ) )
// Subtract 4 for mandatory charaacters already set
rndStr = fn StringSubstringToIndex( rndStr, pwLength - 4 )
MutableStringAppendString( pwStr, rndStr )
end fn = pwStr
 
 
void local fn RandomizeWithSeed
CFStringRef seedStr = fn ControlStringValue( _seedField )
if ( len(seedStr) > 0 )
long seedNum = fn StringIntegerValue( seedStr )
randomize seedNum
else
exit fn
end if
end fn
 
 
void local fn CreatePasswords
NSInteger i
CFMutableStringRef passwords = fn MutableStringWithCapacity(0)
long numberNeeded = fn StringIntegerValue( fn ControlStringValue( _pwAmountField ) )
// Get length of password designated by user
long pwLength = fn StringIntegerValue( fn ControlStringValue( _passwordLengthField ) )
if ( pwLength > 50 ) or ( pwLength < 4 )
fn OutOfBoundsAlert : exit fn
end if
fn RandomizeWithSeed
for i = 1 to numberNeeded
MutableStringAppendString( passwords, fn StringWithFormat( @"%4d. %@%@\n", i, fn BuildPassword, @"\n" ) )
next
TextSetString( _passwordView, passwords )
end fn
 
 
void local fn SaveFile
savepanel -_savePanel, @"Save file...", @"public.plain-text",,,, _true
SavePanelSetCanCreateDirectories( _savePanel, YES )
SavePanelSetAllowedFileTypes( _savePanel, @[@"txt"] )
SavePanelSetExtensionHidden( _savePanel, NO )
// Run savepanel; action captured in fn DoDialog
savepanel _savePanel
end fn
 
 
void local fn SetViewText( url as CFURLRef )
CFStringRef tempStr = fn StringWithContentsOfURL( url, NSUTF8StringEncoding, NULL )
WindowSetTitleWithRepresentedURL( _window, url )
TextSetString( _passwordView, tempStr )
end fn
 
 
void local fn PrintView( tag as long )
TextSetString( _offscreenPrintView, fn TextString( tag ) )
ViewPrint( _offscreenPrintView )
end fn
 
// Build character arrays at launch and save as application property
void local fn CreateCharactersDictionary
CFArrayRef charArray = @[¬
@"0123456789",¬
@"ABCDEFGHIJKLMNOPQRSTUVWXYZ",¬
@"abcdefghijklmnopqrstuvwxyz",¬
@"!\"#$%&'()*+,-./:;<=>?@[]^_{|}~"]
AppSetProperty( @"charArray", charArray )
end fn
 
 
void local fn DoAppEvent( ev as long )
select (ev)
case _appDidFinishLaunching
fn CreateCharactersDictionary
fn BuildMenus
fn BuildPopover
fn BuildWindow
case _appShouldTerminateAfterLastWindowClosed
AppEventSetBool(YES)
end select
end fn
 
 
void local fn DoMenu( menuID as long, itemID as long )
select (menuID)
case _mApplication
select (itemID)
case _iPreferences // show preferences window
end select
case _mFile
select (itemID)
case _iCreate : fn CreatePasswords
case _iSave : fn SaveFile
case _iPrint : fn PrintView( _passwordView )
end select
end select
end fn
 
 
void local fn DoDialog( ev as NSInteger, tag as NSInteger, wnd as NSInteger, obj as CFTypeRef )
select ( ev )
case _btnClick
select ( tag )
case _createPasswordsBtn : fn CreatePasswords
case _saveBtn : fn SaveFile
case _printBtn : fn PrintView( _passwordView )
case _helpBtn : PopoverShow( _helpPopover, CGRectZero, _helpBtn, CGRectMaxXEdge )
end select
end select
end fn
 
on appEvent fn DoAppEvent
on menu fn DoMenu
on dialog fn DoDialog
 
HandleEvents
</syntaxhighlight>
{{output}}
[[File:Password Generator.png]]
 
=={{header|Gambas}}==
'''[https:c/gambas-playground.proko.eu/?gist=0ef1242c761d8a39297fb913fc6a56c0 Click this link to run this code]'''
<langsyntaxhighlight lang="gambas">' Gambas module file
 
' INSTRUCTIONS
Line 2,139 ⟶ 2,540:
Print sPassword 'Print the password list
 
End</langsyntaxhighlight>
Output:
<pre>
Line 2,159 ⟶ 2,560:
 
=={{header|Go}}==
<syntaxhighlight lang="go">
<lang Go>
package main
 
Line 2,252 ⟶ 2,653:
}
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 2,270 ⟶ 2,671:
The function <code>password</code> for given length and a list of char sets which should be included, generates random password.
 
<langsyntaxhighlight Haskelllang="haskell">import Control.Monad
import Control.Monad.Random
import Data.List
Line 2,289 ⟶ 2,690:
x <- uniform lst
xs <- shuffle (delete x lst)
return (x : xs)</langsyntaxhighlight>
 
For example:
Line 2,301 ⟶ 2,702:
User interface (uses a powerful and easy-to-use command-line [https://hackage.haskell.org/package/options-1.2.1.1/docs/Options.html option parser]).
 
<langsyntaxhighlight Haskelllang="haskell">import Options
 
data Opts = Opts { optLength :: Int
Line 2,327 ⟶ 2,728:
, "!\"#$%&'()*+,-./:;<=>?@[]^_{|}~" ]
 
visualySimilar = ["l","IOSZ","012","!|.,"]</langsyntaxhighlight>
 
{{Out}}
Line 2,380 ⟶ 2,781:
Implementation:
 
<langsyntaxhighlight Jlang="j">thru=: <. + i.@(+*)@-~
chr=: a.&i.
 
Line 2,402 ⟶ 2,803:
y must be at least 4 because
passwords must contain four different kinds of characters.
)</langsyntaxhighlight>
 
Example use (from J command line):
 
<langsyntaxhighlight Jlang="j"> pwgen'help'
[x] pwgen y - generates passwords of length y
optional x says how many to generate (if you want more than 1)
Line 2,420 ⟶ 2,821:
Oo?|2oc4yi
9V9[EJ:Txs
$vYd(>4L:m</langsyntaxhighlight>
 
=={{header|Java}}==
{{works with|Java|7}}
<langsyntaxhighlight lang="java">import java.util.*;
 
public class PasswordGenerator {
Line 2,489 ⟶ 2,890:
return sb.toString();
}
}</langsyntaxhighlight>
 
<pre>7V;m
Line 2,503 ⟶ 2,904:
 
=={{header|JavaScript}}==
<langsyntaxhighlight JavaScriptlang="javascript">String.prototype.shuffle = function() {
return this.split('').sort(() => Math.random() - .5).join('');
}
Line 2,556 ⟶ 2,957:
console.log( createPwd( {len: 20, num: 2}) );
console.log( createPwd( {len: 20, num: 2, noSims: false}) );
</syntaxhighlight>
</lang>
{{out}}<pre>
> Q^g"7
Line 2,564 ⟶ 2,965:
</pre>
 
 
=={{header|jq}}==
{{Works with|jq}}
 
'''Works with gojq, the Go implementation of jq'''
 
'''Adapted from [[#Julia|Julia]]'''
 
The following assumes that an external source of randomness such as /dev/urandom is available
and that jq is invoked along the lines of the following:
<pre>
< /dev/urandom tr -cd '0-9' | fold -w 1 | jq -MRnr -f password-generator.jq
</pre>
<syntaxhighlight lang="jq">
# Output: a prn in range(0;$n) where $n is `.`
def prn:
if . == 1 then 0
else . as $n
| ([1, (($n-1)|tostring|length)]|max) as $w
| [limit($w; inputs)] | join("") | tonumber
| if . < $n then . else ($n | prn) end
end;
 
# Input: an array
# Output: an array, being a selection of $k elements from . chosen with replacement
def prns($k):
. as $in
| length as $n
| [range(0; $k) | $in[$n|prn]];
 
def knuthShuffle:
length as $n
| if $n <= 1 then .
else {i: $n, a: .}
| until(.i == 0;
.i += -1
| (.i + 1 | prn) as $j
| .a[.i] as $t
| .a[.i] = .a[$j]
| .a[$j] = $t)
| .a
end;
 
# Generate a single password of length $len >= 4;
# certain confusable characters are only allowed iff $simchars is truthy.
def passgen($len; $simchars):
def stoa: explode | map([.]|implode);
if $len < 4 then "length must be at least 4" | error
else
{ DIGIT: ("0123456789" | stoa),
UPPER: [range(65;91) | [.] | implode], # A-Z
LOWER: [range(97;123) | [.] | implode], # a-z
OTHER: ("!\"#$%&'()*+,-./:;<=>?@[]^_{|}~" | stoa) }
| if $simchars|not
then .DIGIT |= . - ["0", "1", "2", "5"]
| .UPPER |= . - ["O", "I", "Z", "S"]
| .LOWER |= . - ["l"]
end
| (reduce (.DIGIT, .UPPER, .LOWER, .OTHER) as $set ([];
. + ($set | prns(1)))) +
(.DIGIT + .UPPER + .LOWER + .OTHER | prns($len - 4))
| knuthShuffle
| join("")
end ;
 
def passgen($len):
passgen($len; true);
 
# Generate a stream of $npass passwords, each of length $len;
# certain confusable characters are only allowed iff $simchars is truthy.
def passgen($len; $npass; $seed; $simchars):
if ($seed | type) == "number" and $seed > 0 then $seed | prn else null end
| range(0; $npass)
| passgen($len; $simchars) ;
 
 
### Examples:
"Without restriction:", passgen(12; 5; null; true),
"",
"Certain confusable characters are disallowed:", passgen(12; 5; null; false)
</syntaxhighlight>
{{output}}
<pre>
Without restriction:
yT8+9t7=wfEn
#]j<HIpThJ6A
|~O{psk*[5)I
w_(N%QrI5:5#
$o3sfdKv"'9~
 
Certain confusable characters are disallowed:
>oXgj>H9wX^[
a^JR+v!bk6GU
7$~yp?YG]G|E
!/_MM_g.p{a4
iD?+xU+!A4]R
</pre>
=={{header|Julia}}==
{{works with|Julia|0.6}}
 
<langsyntaxhighlight lang="julia">function passgen(len::Integer; simchars::Bool=true)::String
if len < 4; error("length must be at least 4") end
# Definitions
Line 2,595 ⟶ 3,094:
end
 
passgen(stdout, 10, 12; seed = 1)</langsyntaxhighlight>
 
{{out}}
Line 2,612 ⟶ 3,111:
 
=={{header|Kotlin}}==
<langsyntaxhighlight Groovylang="groovy">// version 1.1.4-3
 
import java.util.Random
Line 2,802 ⟶ 3,301:
generatePasswords(pwdLen!!, pwdNum!!, toConsole, toFile!!)
}</langsyntaxhighlight>
 
Sample input and output:
Line 2,834 ⟶ 3,333:
 
=={{header|Lua}}==
<langsyntaxhighlight Lualang="lua">function randPW (length)
local index, pw, rnd = 0, ""
local chars = {
Line 2,863 ⟶ 3,362:
os.exit()
end
for i = 1, arg[2] do print(randPW(tonumber(arg[1]))) end</langsyntaxhighlight>
Command line session:
<pre>>lua pwgen.lua
Line 2,882 ⟶ 3,381:
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<langsyntaxhighlight Mathematicalang="mathematica">(* Length is the Length of the password, num is the number you want, \
and similar=1 if you want similar characters, 0 if not. True and \
False, should work in place of 1/0 *)
Line 2,912 ⟶ 3,411:
]</langsyntaxhighlight>
 
=={{header|Nim}}==
<langsyntaxhighlight Nimlang="nim">import os, parseopt, random, sequtils, strformat, strutils
 
const Symbols = toSeq("!\"#$%&'()*+,-./:;<=>?@[]^_{|}~")
Line 3,013 ⟶ 3,512:
# Display the passwords.
for pw in passGen(passLength, count, seed, excludeSimilars):
echo pw</langsyntaxhighlight>
 
{{out}}
Line 3,026 ⟶ 3,525:
=={{header|OCaml}}==
 
<langsyntaxhighlight lang="ocaml">let lower = "abcdefghijklmnopqrstuvwxyz"
let upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
let digit = "0123456789"
Line 3,082 ⟶ 3,581:
for i = 1 to !num do
print_endline (mk_pwd !len !readable)
done</langsyntaxhighlight>
 
{{out}}
Line 3,104 ⟶ 3,603:
=={{header|ooRexx}}==
{{trans||REXX}}
<langsyntaxhighlight lang="oorexx">/*REXX program generates a random password according to the Rosetta Code task's rules.*/
parse arg L N seed xxx dbg /*obtain optional arguments from the CL*/
casl= 'abcdefghijklmnopqrstuvwxyz' /*define lowercase alphabet. */
Line 3,201 ⟶ 3,700:
¦ dbg Schow count of characters in the 4 groups ¦
+-----------------------------------------------------------------------------+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~documentation ends on the previous line.~~~~~~~~~~~~~~~~~~~*/</langsyntaxhighlight>
{{out}}
<pre>D:\>rexx genpwd 12 4 33 , x
Line 3,226 ⟶ 3,725:
 
PARI/GP has a very good builtin random generator.
<langsyntaxhighlight lang="parigp">passwd(len=8, count=1, seed=0) =
{
if (len <= 4, print("password too short, minimum len=4"); return(), seed, setrand(seed));
Line 3,240 ⟶ 3,739:
}
 
addhelp(passwd, "passwd({len},{count},{seed}): Password generator, optional: len (min=4, default=8), count (default=1), seed (default=0: no seed)");</langsyntaxhighlight>
 
Output: ''passwd()''<pre>34K76+mB</pre>
Line 3,260 ⟶ 3,759:
 
=={{header|Pascal}}==
<syntaxhighlight lang="pascal">
<lang PASCAL>
program passwords (input,output);
 
Line 3,437 ⟶ 3,936:
end.
 
</syntaxhighlight>
</lang>
Useage for the output example: passwords --about -h --length=12 --number 12 --exclude
 
Line 3,472 ⟶ 3,971:
=={{header|Perl}}==
Use the module <tt>Math::Random</tt> for marginally better random-ness than the built-in function, but no warranty is expressed or implied, <i>caveat emptor</i>.
<langsyntaxhighlight lang="perl">use strict;
use warnings;
use feature 'say';
Line 3,521 ⟶ 4,020:
[--help]
END
}</langsyntaxhighlight>
{{out}}
<pre>sc3O~3e0
Line 3,531 ⟶ 4,030:
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(phixonline)-->
<span style="color: #000080;font-style:italic;">--with javascript_semantics -- not quite yet:</span>
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span> <span style="color: #000080;font-style:italic;">-- (VALUECHANGED_CB not yet triggering)</span>
Line 3,588 ⟶ 4,087:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</langsyntaxhighlight>-->
{{out}}
With a length of 12 and generating 6 of them
Line 3,601 ⟶ 4,100:
 
=={{header|PicoLisp}}==
<langsyntaxhighlight PicoLisplang="picolisp">#!/usr/bin/pil
 
# Default seed
Line 3,664 ⟶ 4,163:
(rot '(*UppChars *Others *Digits *LowChars))) ) ) ) ) ) ) )
 
(bye)</langsyntaxhighlight>
Test:
<pre>$ genpw --help
Line 3,685 ⟶ 4,184:
 
=={{header|PowerShell}}==
<syntaxhighlight lang="powershell">
<lang PowerShell>
function New-RandomPassword
{
Line 3,805 ⟶ 4,304:
}
}
</syntaxhighlight>
</lang>
<syntaxhighlight lang="powershell">
<lang PowerShell>
New-RandomPassword -Length 12 -Count 4 -ExcludeSimilar
</syntaxhighlight>
</lang>
{{Out}}
<pre>
Line 3,817 ⟶ 4,316:
</pre>
Make it Unix-like:
<syntaxhighlight lang="powershell">
<lang PowerShell>
Set-Alias -Name nrp -Value New-RandomPassword -Description "Generates one or more passwords"
 
nrp -l 12 -n 4 -x
</syntaxhighlight>
</lang>
{{Out}}
<pre>
Line 3,832 ⟶ 4,331:
=={{header|Prolog}}==
{{works with|SWI-Prolog|7.6.4 or higher}}
<langsyntaxhighlight Prologlang="prolog">:- set_prolog_flag(double_quotes, chars).
:- initialization(main, main).
 
Line 3,889 ⟶ 4,388:
pword_char( upper, C ) :- member( C, "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ).
pword_char( digits, C ) :- member( C, "0123456789" ).
pword_char( special, C ) :- member( C, "!\"#$%&'()*+,-./:;<=>?@[]^_{|}~" ).</langsyntaxhighlight>
{{out}}
Showing help
Line 3,925 ⟶ 4,424:
 
=={{header|PureBasic}}==
<langsyntaxhighlight PureBasiclang="purebasic">EnableExplicit
 
Procedure.b CheckPW(pw.s)
Line 4,046 ⟶ 4,545:
~"Blabla blabla bla blablabla."
EndOfHelp:
EndDataSection</langsyntaxhighlight>
{{out}}
<pre>Length of the password (n>=4): 10
Line 4,067 ⟶ 4,566:
=={{header|Python}}==
 
<langsyntaxhighlight lang="python">import random
 
lowercase = 'abcdefghijklmnopqrstuvwxyz' # same as string.ascii_lowercase
Line 4,101 ⟶ 4,600:
for i in range(qty):
print(new_password(length, readable))
</syntaxhighlight>
</lang>
{{output}}
<pre>>>> password_generator(14, 4)
Line 4,115 ⟶ 4,614:
 
=={{header|R}}==
<syntaxhighlight lang="r">
<lang r>
passwords <- function(nl = 8, npw = 1, help = FALSE) {
if (help) return("gives npw passwords with nl characters each")
Line 4,140 ⟶ 4,639:
## Tj@T19L.q1;I*]
## 6M+{)xV?i|1UJ/
</syntaxhighlight>
</lang>
 
=={{header|Racket}}==
<langsyntaxhighlight lang="racket">
#lang racket
 
Line 4,204 ⟶ 4,703:
 
(run (len) (cnt) (seed) (readable?))
</syntaxhighlight>
</lang>
'''Sample output:'''
<pre>
Line 4,219 ⟶ 4,718:
{{works with|Rakudo|2016.05}}
 
<syntaxhighlight lang="raku" perl6line>my @chars =
set('a' .. 'z'),
set('A' .. 'Z'),
Line 4,252 ⟶ 4,751:
{$*PROGRAM-NAME} --l=14 --c=5 --x=0O\\\"\\\'1l\\\|I
END
}</langsyntaxhighlight>
'''Sample output:'''
Using defaults:
Line 4,264 ⟶ 4,763:
 
===functional===
<syntaxhighlight lang="raku" perl6line>my @char-groups =
['a' .. 'z'],
['A' .. 'Z'],
Line 4,298 ⟶ 4,797:
Password must have at least one of each: lowercase letter, uppercase letter, digit, punctuation.
END
}</langsyntaxhighlight>
'''Sample output:'''
 
Line 4,332 ⟶ 4,831:
:::* &nbsp; checking if the hexadecimal literal &nbsp; ('''yyy''') &nbsp; is valid
:::* &nbsp; checking (for instance) if all digits were excluded via the &nbsp; <b>'''xxx'''</b> &nbsp; and/or &nbsp; '''yyy''' &nbsp; option
<langsyntaxhighlight lang="rexx">/*REXX program generates a random password according to the Rosetta Code task's rules.*/
@L='abcdefghijklmnopqrstuvwxyz'; @U=@L; upper @U /*define lower-, uppercase Latin chars.*/
@#= 0123456789 /* " " string of base ten numerals.*/
Line 4,387 ⟶ 4,886:
║ The default is to use all the (normal) available characters. ║
║ yyy (same as XXX, except the chars are expressed as hexadecimal pairs).║
╚═════════════════════════════════════════════════════════════════════════════╝ */</langsyntaxhighlight>
'''output''' &nbsp; when using the inputs of: &nbsp; <tt> 10 &nbsp; 20 </tt>
<pre>
Line 4,413 ⟶ 4,912:
 
=={{header|Ring}}==
<langsyntaxhighlight lang="ring">
# Project : Password generator
 
Line 4,458 ⟶ 4,957:
end
fclose(fp)
</syntaxhighlight>
</lang>
Output:
<pre>
Line 4,465 ⟶ 4,964:
password = u8/Ah8%H
password = c4\Nc2_J
</pre>
 
=={{header|RPL}}==
{{works with|HP|48G}}
« "!" 34 CHR + "#$%&'()*+,-./:;<=>?@[]^_{|}~" + "" → chars pwd
« { 0 0 0 0 }
'''WHILE''' DUP2 ∑LIST 4 ≠ OR '''REPEAT'''
RAND 4 * CEIL
{ « RAND 25 * FLOOR 65 + CHR »
« RAND 25 * FLOOR 97 + CHR »
« RAND 10 * FLOOR →STR »
« chars RAND OVER SIZE * CEIL DUP SUB » }
OVER GET EVAL 'pwd' STO+
1 PUT
SWAP 1 - 0 MAX SWAP
'''END''' DROP2 pwd
» » '<span style="color:blue">→PWD</span>' STO ''<span style="color:grey">@ ( length → "password" )''</span>
« → length n
« '''IF''' length 4 < '''THEN'''
"Length must be at least 4" DOERR
'''ELSE'''
{ }
1 n '''FOR''' j
'''WHILE''' length <span style="color:blue">→PWD</span> DUP SIZE length > '''REPEAT''' DROP '''END'''
+
'''NEXT'''
'''END'''
» » '<span style="color:blue">PWDS</span>' STO <span style="color:grey">''@ ( length n → { "password1" .. "passwordn" } )''</span>
 
8 3 <span style="color:blue">PWDS</span>
{{out}}
<pre>
1: { "v7-c8d.B" "oVe1M$17" "R+I6vJ9j" }
</pre>
 
=={{header|Ruby}}==
<langsyntaxhighlight Rubylang="ruby">ARRS = [("a".."z").to_a,
("A".."Z").to_a,
("0".."9").to_a,
Line 4,484 ⟶ 5,017:
 
puts generate_pwd(8,3)
</syntaxhighlight>
</lang>
 
=={{header|Run BASIC}}==
<langsyntaxhighlight Runbasiclang="runbasic">a$(1) = "0123456789"
a$(2) = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
a$(3) = "abcdefghijklmnopqrstuvwxyz"
Line 4,526 ⟶ 5,059:
goto [main]
[exit] ' get outta here
end</langsyntaxhighlight>Output:
<pre>Generate 10 passwords with 7 characters
#1 69+;Jj8
Line 4,539 ⟶ 5,072:
#10 f0Qho:5</pre>
=={{header|Rust}}==
<langsyntaxhighlight lang="rust">
use rand::distributions::Alphanumeric;
use rand::prelude::IteratorRandom;
Line 4,613 ⟶ 5,146:
}
}
</syntaxhighlight>
</lang>
{{out}}
<pre>
Line 4,627 ⟶ 5,160:
=={{header|Scala}}==
Using SBT to run rather than a shell script or executable jar:
<langsyntaxhighlight lang="scala">object makepwd extends App {
 
def newPassword( salt:String = "", length:Int = 13, strong:Boolean = true ) = {
Line 4,694 ⟶ 5,227:
 
if( count > 1 ) println
}</langsyntaxhighlight>
{{output}}
> sbt "run --help"
Line 4,719 ⟶ 5,252:
 
=={{header|Seed7}}==
<langsyntaxhighlight lang="seed7">$ include "seed7_05.s7i";
 
const func string: generate (in integer: length) is func
Line 4,774 ⟶ 5,307:
end if;
end if;
end func;</langsyntaxhighlight>
 
{{out}}
Line 4,792 ⟶ 5,325:
Swift uses arc4random() to generate fast and high quality random numbers. However the usage of a user defined seed is not possible within arc4random(). To fulfill the requirements this code uses the C functions srand() and rand() that are integrated into the Swift file via an Bridging-Header.<br><br>
'''C file to generate random numbers'''
<langsyntaxhighlight Clang="c">#include <stdlib.h>
#include <time.h>
 
Line 4,806 ⟶ 5,339:
int getRand(const int upperBound){
return rand() % upperBound;
}</langsyntaxhighlight>
 
'''Bridging-Header to include C file into Swift'''
<langsyntaxhighlight Clang="c">int getRand(const int upperBound);
void initRandom(const unsigned int seed);</langsyntaxhighlight>
 
'''Swift file'''
<langsyntaxhighlight lang="swift">import Foundation
import GameplayKit // for use of inbuilt Fisher-Yates-Shuffle
 
Line 4,936 ⟶ 5,469:
for i in 1...count {
print("\(i).\t\(generatePassword(length:length,exclude:xclude))")
}</langsyntaxhighlight>
{{out}}
<pre>$ PasswordGenerator -h
Line 4,955 ⟶ 5,488:
 
=={{header|VBA}}==
<syntaxhighlight lang="vb">
<lang vb>
Option Explicit
Sub Main()
Line 5,153 ⟶ 5,686:
End If
z = temp
End Function</langsyntaxhighlight>
{{out}}
Function Gp :
Line 5,202 ⟶ 5,735:
{{libheader|Wren-ioutil}}
{{libheader|Wren-fmt}}
<langsyntaxhighlight pythonlang="wren">import "random" for Random
import "./ioutil" for FileUtil, File, Input
import "./fmt" for Fmt
import "os" for Process
 
Line 5,336 ⟶ 5,869:
}
 
generatePasswords.call(pwdLen, pwdNum, toConsole, toFile)</langsyntaxhighlight>
 
{{out}}
Line 5,366 ⟶ 5,899:
 
The generated passwords have been written to the file pwds.txt
</pre>
 
=={{header|XPL0}}==
{{trans|Python}}
<syntaxhighlight lang "XPL0">string 0;
 
func In(C, Str);
char C, Str;
[while Str(0) do
if C = Str(0) then return true else Str:= Str+1;
return false;
];
 
func New_password(Length, Readable);
int Length, Readable, I, C;
char Password_chars(100), Punctuation, Visually_similar;
[if Length < 4 then
[Text(0, "Password length = "); IntOut(0, Length);
Text(0, " is too short, minimum length = 4.");
return "";
];
Punctuation:= "!^"#$%&\'()*+,-./:;<=>?@[]^^_{|}~";
Visually_similar:= "Il1O05S2Z";
for I:= 0 to Length-1 do
[case Ran(4) of
0: C:= Ran(26) + ^a;
1: C:= Ran(26) + ^A;
2: C:= Ran(10) + ^0;
3: C:= Punctuation(Ran(31))
other [];
Password_chars(I):= C;
if Readable and In(C, Visually_similar) then I:= I-1;
];
Password_chars(I):= 0;
return Password_chars;
];
 
proc Password_generator(Length, Qty, Readable);
int Length, Qty, Readable, I;
for I:= 0 to Qty-1 do
[Text(0, New_password(Length, Readable)); CrLf(0)];
 
[Password_generator(14, 4, true);
Password_generator( 8, 4, false);
]</syntaxhighlight>
{{out}}
<pre>
GojA9ep6=3|U,\
U9@p|f'WH7+&TM
8=E7xvm6J9Y([q
zrknig;8Pv+(Va
37s11T68
Ir)wY0P<
54d3o]Ga
95??s]"O
</pre>
 
=={{header|zkl}}==
Put the following code into a file (such as pwdg.zkl):
<langsyntaxhighlight lang="zkl">var pwdLen=10, pwds=1, xclude="";
 
argh:=Utils.Argh(
Line 5,391 ⟶ 5,979:
pwd:=T(g1,g2,g3,g4).pump(Data,rnd); // 1 from each of these into a Data
pwd.extend(fill()).shuffle().text.println();
}</langsyntaxhighlight>
This is a command line program so output can be redirected.
{{out}}
1,150

edits