Results 1 to 11 of 11

Thread: Function: Password Maker

  1. #1
    Join Date
    Mar 2008
    Location
    Indiana
    Posts
    192
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Function: Password Maker

    I made a password maker function for people making new accounts
    and such.
    I plan on continuing this with a account maker.

    If you plan on using this Plus Rep ++ please.
    SCAR Code:
    function PassMaker(lengthofpass: integer): string;
    var
    chars, pass, passpart : string;
    B, passnum : integer;
    begin
      chars := 'abcd efgh ijk lmnopqrs tuvwxyz123 45678 90';
      passnum := 0;
      repeat
        passnum := passnum + 1;
        B := random(42) + 1;
        passpart := copy(chars, B, 1);
        insert(passpart, pass, passnum);
      until(passnum = lengthofpass);
      result := pass;
    end;

    Sample Script: Just spits out passwords according to the length you set it.
    SCAR Code:
    program Passmaker;

    function PassMaker(lengthofpass: integer): string;
    var
    chars, pass, passpart : string;
    B, passnum : integer;
    begin
      chars := 'abcd efgh ijk lmnopqrs tuvwxyz123 45678 90';
      passnum := 0;
      repeat
        passnum := passnum + 1;
        B := random(42) + 1;
        passpart := copy(chars, B, 1);
        insert(passpart, pass, passnum);
      until(passnum = lengthofpass);
      result := pass;
    end;

    begin
      cleardebug;
      writeln(PassMaker(8));
    end.

  2. #2
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    There is a easier way:
    SCAR Code:
    Function PassMaker(Len:integer):string;
    var
      I:integer;
      Cha:string;
    begin
      Cha := 'abcdefghijklmnopqrstvuwxyz0123456789';
      for I := 1 to Len do
        result := result + Cha[random(Length(cha))+1];
    end;

    Didn't want to brag, okay maybe a little. But there is faster and shorter ways for randomizing strings. I've used this quite a bit.

    Check out my Name Generator too.
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  3. #3
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    It can get even shorter than that...
    SCAR Code:
    function MakePassword(Length: Integer): String;
    var
      I: Integer;
    begin
      for I:= 1 to Length do
        Result:= Result + String('abcdefghijklmnopqrstvuwxyz0123456789')[Random(36) + 1];
    end;

  4. #4
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    You both got pwned by a junior member... Like I got yesterday...

    I think it was Mixter - the function was something like this:

    SCAR Code:
    Function Password(Len: Integer): String;

    Begin
      While Length(Result) < Len Do
        Result := Result + Chr(65 + Random(26));
    End;

    Even it calls length every round, I think that's a nice "invention" for a jr member... though I don't know did he make it himself, but anyways...


    Narcle: You have the wrong idea about bragging

  5. #5
    Join Date
    Dec 2006
    Location
    .̿̂̔͋͗̎̆ͥ̍̒ͤ͂̾̌̀̅
    Posts
    3,012
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    SCAR Code:
    Function Password(Len: Integer): String;

    Begin
      While Length(Result) < Len Do
        Result := Result + Chr(65 + Random(26));
    End;
    I was thinking of making something like that and posting here, but the good ol' laziness struck me again and I just decided to be useless as always.

  6. #6
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    You both got pwned by a junior member... Like I got yesterday...

    I think it was Mixter - the function was something like this:

    SCAR Code:
    Function Password(Len: Integer): String;

    Begin
      While Length(Result) < Len Do
        Result := Result + Chr(65 + Random(26));
    End;

    Even it calls length every round, I think that's a nice "invention" for a jr member... though I don't know did he make it himself, but anyways...


    Narcle: You have the wrong idea about bragging
    Ha I like it.
    Bragging... ha hardly. It was just to ease the suffering.

    "You both got pwned by a junior member... Like I got yesterday..." Indeed.

    Does the While really repeat for that? Looks ominous but if it works... thats all that matters.

    Oh and "Length(Result) < Len" so the password is always Len-1 long?
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  7. #7
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    so it will tell you the p.w in your debug?

  8. #8
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nope..., add writln(result);
    maybe inttostr needed to...
    ~Hermen

  9. #9
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    : String;
    -.- @ Hermpie...

    Oh and "Length(Result) < Len" so the password is always Len-1 long?
    Consider again - if it was " <= " it would make it one letter longer

  10. #10
    Join Date
    Jun 2006
    Posts
    3,861
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by n3ss3s View Post
    You both got pwned by a junior member... Like I got yesterday...

    I think it was Mixter - the function was something like this:

    SCAR Code:
    Function Password(Len: Integer): String;

    Begin
      While Length(Result) < Len Do
        Result := Result + Chr(65 + Random(26));
    End;

    Even it calls length every round, I think that's a nice "invention" for a jr member... though I don't know did he make it himself, but anyways...


    Narcle: You have the wrong idea about bragging
    I would have done something like how he did the result, but it can't do numbers... I didn't think of the while loop though, that was smart

  11. #11
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    People always forget the 's'
    I could've made it do numbers (like Bullzeye did with the String('abcetc.') but having a whole string there makes it not look as cool
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Srl Id And Srl Password
    By lefamaster in forum OSR Help
    Replies: 2
    Last Post: 02-21-2007, 04:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •