Jump to content

Random Pass. Generator


dufran3
 Share

Recommended Posts

Dim $Letter[8] ;Increase for longer string size
$StringSize = Ubound($Letter)

For $i = 0 to $StringSize -1
If Random() < 0.33 Then
    ;Capitals
    $Letter[$i] = Chr(Random(Asc("A"), Asc("Z"), 1))
ElseIf Random() < 0.66 Then
    ;Lower case
    $Letter[$i] = Chr(Random(Asc("a"), Asc("z"), 1))
Else
    ;Special Character
    $Letter[$i] = Chr(Random(Asc("!"), Asc("*"), 1))
Endif
Next

ConsoleWrite($Letter[0] & $Letter[1] & $Letter[2] & $Letter[3] & $Letter[4] & $Letter[5] & $Letter[6] & @LF)

Link to comment
Share on other sites

ConsoleWrite(_makePW(8) & @CRLF)

Func _makePW($length)
    Local $ret, $i

    For $i = 1 to $length
        Switch Random(1,12,1)
            Case 1 To 4
                $ret &= Chr(Random(65, 90, 1))
            Case 5 To 8
                $ret &= Chr(Random(97, 122, 1))
            Case Else
                $ret &= Chr(Random(33, 42, 1))
        EndSwitch
    Next

    Return $ret
EndFunc

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

It's good but IMO you should take off all special char since in most case they aren't accepted.

I tend to use mnemonic passwords for users, because they are pretty easy to remember. They usually consist of a pairs of consonant-vocal combination. e.g. naguriby (y is phonetic similar to i (in german)).

I eaven once wrote a pw generator in Autoit for this.

:)

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

I dont use random passwords, I made a code up some time ago, so I never forget them, I only have to look at the url or name of the website and almost instantly remember the password, even if I havent entered it for 2 years.

Pros. My passwords are never stored digitally or written anywhere

cons. if my code is broken, they are all broken.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Hi Folks,

here's my pwgenerator, it's basic and simple. As I already said I use it to create (initial) passwords for users, so they should not be very hard to remember. Because if they are hard to remember, then you may find the PW under the keyboard sometimes. :)

Func _pwGen($i_len)
    $s_pw = ""
    $s_voc = "aeiouyj"
    $s_con = "bcdfghklmnprstvwxz"
    $i_pos_num = Random(0, ($i_len - 2) / 2, 1) * 2

    Do
        If StringLen($s_pw) = $i_pos_num Then $s_pw &= Random(0, 9, 1) & Random(0, 9, 1)
        If StringLen($s_pw) < ($i_len)  Then $s_pw &= StringMid($s_con, Random(1, StringLen($s_con) - 1, 1), 1) & StringMid($s_voc, Random(1, StringLen($s_voc) - 1, 1), 1)
    Until StringLen($s_pw) = ($i_len)

    Return $s_pw
EndFunc
Edited by Hannes123
Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

Hi Folks,

here's my pwgenerator, it's basic and simple. As I already said I use it to create (initial) passwords for users, so they should not be very hard to remember. Because if they are hard to remember, then you may find the PW under the keyboard sometimes. :)

If StringLen($s_pw) < ($i_len)  Then $s_pw &= StringMid($s_con, Random(1, StringLen($s_con) - 1, 1), 1) & StringMid($s_voc, Random(1, StringLen($s_voc) - 1, 1), 1)

You should correct that line above and change it so that the StringLen commands don't subtract 1, otherwise you'll never have a password with a Z or J in it.

If StringLen($s_pw) < ($i_len)  Then $s_pw &= StringMid($s_con, Random(1, StringLen($s_con), 1), 1) & StringMid($s_voc, Random(1, StringLen($s_voc), 1), 1)

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I like it though, it's simple and easy to understand. Although it won't work for everything, because some times you need non-alphanumeric characters or uppercase letters, it does the job well.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...