Re: Password Generator



JRS: In article <INM7f.1382$AS6.1135@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
dated Wed, 26 Oct 2005 14:55:36, seen in news:comp.lang.pascal.delphi.mi
sc, Charles Appel <charlesappel@xxxxxxxxxxxxxx> posted :
>"Ryan Styles" <Ryan@xxxxxxxxxx> wrote in message
>news:ge6tl1pi10eet2nqm2mbvs37opn4mtq6qp@xxxxxxxxxx

>> I need to make a password generator which supports plain text, numeric
>> and alphanumeric. Can anyone give me a steer in the right direction so
>> I can find my way in coding this? A link to a resource would be
>> helpful. Just anything to get me going on learning.
>
>const
> LowerAlpha = 'abcdefghijklmnopqrstuvwxyz';
> UpperAlpha = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
> Numbers = '0123456789';
>
>function AlphaPassword( NumChars: integer): string;
>var
> Upper: Boolean;
> CharCount: integer;
> TempString: string;
>begin
> TempString := '';
> for CharCount := 1 to NumChars do
> begin
> Upper := ( (random(10) + 1) > 5 );
> if Upper then
> TempString := TempString + UpperAlpha[random(26)+1]
> else
> TempString := TempString + LowerAlpha[random(26)+1];
> end;
> result := TempString;
>end;

const S =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

function Password( NumChars: integer): string;
var CharCount: integer;
begin result := '';
for CharCount := 1 to NumChars do result := result + S[random(62)+1];
end;

may suffice.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt> RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal FAQ.
.



Relevant Pages

  • Re: Need Password Generator for 10 users
    ... Password generator? ... One cell with a "base string" of permitted password characters. ... Digit "zero" and uppercase letter O; Lowercase letter L, uppercase letter I and digit "one" ...
    (comp.security.misc)
  • Re: Password Generator
    ... > I need to make a password generator which supports plain text, ... Upper: Boolean; ... CharCount: integer; ... TempString: string; ...
    (comp.lang.pascal.delphi.misc)
  • Re: Password Generator
    ... >> I need to make a password generator which supports plain text, ... > Upper: Boolean; ... > CharCount: integer; ...
    (comp.lang.pascal.delphi.misc)