Re: Password Generator



On Wed, 26 Oct 2005 14:55:36 GMT, "Charles Appel"
<charlesappel@xxxxxxxxxxxxxx> wrote:

>"Ryan Styles" <Ryan@xxxxxxxxxx> wrote in message
>news:ge6tl1pi10eet2nqm2mbvs37opn4mtq6qp@xxxxxxxxxx
>> Hi all.
>>
>> 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;
>
>procedure TForm1.Button1Click(Sender: TObject);
>begin
> Label1.Caption := AlphaPassword(10);
>end;
>
>initialization
> randomize;
>end.
>
>Similar functions could be written to return alphnumeric
>and numeric passwords.
>

Thanks for the code, appreciate the help.

-- Ryan
.


Quantcast