Re: Password Generator
- From: Dr John Stockton <jrs@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Oct 2005 16:32:31 +0100
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.
.
- Follow-Ups:
- Re: Password Generator
- From: Nicholas Sherlock
- Re: Password Generator
- References:
- Password Generator
- From: Ryan Styles
- Re: Password Generator
- From: Charles Appel
- Password Generator
- Prev by Date: Re: DBLookupComboBox question
- Next by Date: Re: Password Generator
- Previous by thread: Re: Password Generator
- Next by thread: Re: Password Generator
- Index(es):
Relevant Pages
|