Results 1 to 4 of 4

Thread: Key generation

  1. #1
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Key generation

    I am new to javascript but i have created these number and key gens. Tell me if you can find a use please:

    key gen:
    http://www.stuff.pissedandhappy.co.uk/password-gen.txt

    and the number gen:
    http://www.stuff.pissedandhappy.co.uk/numbergen.html

    To get a new number or key just refresh.

    The script works on the "Math.random" code, it is simply 10 codes running against each other. Anyway, any use of these what so ever would be great.

    Peter

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Wouldn't it be better (and shorter) to make an alphanumeric array from which the 10 spots just pulled from the same pool?

    Instead of giving each a finite set of numbers/letters.

    If I refresh enough times I will see the same code.

    I can't think of any practical uses for it the way it is now though.
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,162
    Thanks
    263
    Thanked 690 Times in 678 Posts

    Default

    And the fact that it all exists as seperate script is just awkward.

    There's already a thread going about this, where I posted a PHP example of a generator that actually grabs a random character, not just a predefined character based on a random number.

    http://www.dynamicdrive.com/forums/s...ad.php?t=15831

    PHP Code:
    <?php
    $len 
    8//set pass length //in this case, 8
    for ($n=0;$n<$len;$n++) { //loop starting at 0, while less than len value
    $ord rand(1,62); //10num+26LET+26let //add more if you want
    if ($ord <= 10) {$ord += 47;} //numbers
    else if ($ord <= 36) {$ord += 54;} //LETTERS
    else { $ord += 60; } //letters
    //include other sets of chars if you want
    $pass .= chr($ord); //add char to existing password
    }
    echo 
    $pass//output password
    ?>
    http://ci-pro.com/misc/phptest/passgen.php
    Test page^.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,486
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    OOO nice one djr. I like that little snippet. May I use that on my site??
    {CWoT - Riddle } {OSTU - Psycho} {Invasion - Team}
    Follow Me on Twitter: @Negative_Chaos
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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