anixon Posted June 18, 2007 Share Posted June 18, 2007 This code generates or can regenerate the same new password based on inputing an existing or previous password and it works quite fine. What I having difficulty getting my mind around is how to change the processing from individual sequental input to being able to input the old password and have it generate the new password in one input process. This is the code: CODE#Include<Array.au3> ;Script to generate a new password from an existing password. The random order of A-Z and 0-9 in the new password array ;is not executed using the random function for A-Z so that the new password can be re-regenerated using the old password as ;and when required. ; Variables Global $i = 0, $value1 = "", $value2 = "", $value3 = "", $value4 = "", $value5 = "", $value6 = "", _ $value7 = "", $value8 = "", $value9 = "", $value10 = "", $value11 = "", $value12 = "", $Iarray = "" ;Establish an Array A-Z 0-9 to the convert the Alpha/Numeric Input into an array position number. While 1 Dim $Array[37] $Array[0] = "" $Array[1] = "A" $Array[2] = "B" $Array[3] = "C" $Array[4] = "D" $Array[5] = "E" $Array[6] = "F" $Array[7] = "G" $Array[8] = "H" $Array[9] = "I" $Array[10] = "J" $Array[11] = "K" $Array[12] = "L" $Array[13] = "M" $Array[14] = "N" $Array[15] = "O" $Array[16] = "P" $Array[17] = "Q" $Array[18] = "R" $Array[19] = "S" $Array[20] = "T" $Array[21] = "U" $Array[22] = "V" $Array[23] = "W" $Array[24] = "X" $Array[25] = "Y" $Array[26] = "Z" $Array[27] = "0" $Array[28] = "1" $Array[29] = "2" $Array[30] = "3" $Array[31] = "4" $Array[32] = "5" $Array[33] = "6" $Array[34] = "7" $Array[35] = "8" $Array[36] = "9" ;Input and individually process each letter/number of the old password $Input = InputBox("Password Generator", "Input an Alpha/Numeric", "", " M1") If @error Then ExitLoop ;Find the input position number $Pos = _ArraySearch($Array, $Input, 0, 0, 0, True) ;Based on the input position number generate a letter/number for the new password $alpha = StringSplit("X,M,H,G,T,R,S,P,C,W,J,F,W,B,Q,K,O,L,U,Z,D,A,V,Y,I,N,4,9,3,6,1,2,7,5,0,8", ",") ;Process for concatinated output $i = $i + 1 If $i = 13 Then Exit $vkey = $alpha[$Pos] If $i = 1 Then $value1 = $vkey ElseIf $i = 2 Then $value2 = $vkey ElseIf $i = 3 Then $value3 = $vkey ElseIf $i = 4 Then $value4 = $vkey ElseIf $i = 5 Then $value5 = $vkey ElseIf $i = 6 Then $value6 = $vkey ElseIf $i = 7 Then $value7 = $vkey ElseIf $i = 8 Then $value8 = $vkey ElseIf $i = 9 Then $value9 = $vkey ElseIf $i = 10 Then $value10 = $vkey ElseIf $i = 11 Then $value11 = $vkey ElseIf $i = 12 Then $value12 = $vkey EndIf WEnd ;Concatinate and display the new password MsgBox(0, "", $value1 & $value2 & $value3 & $value4 & $value5 & $value6 & $value7 & $value8 & $value9 & $value10 & $value11 & $value12) Exit Help is aways appreciated Ant.. Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 18, 2007 Share Posted June 18, 2007 This code generates or can regenerate the same new password based on inputing an existing or previous password and it works quite fine. What I having difficulty getting my mind around is how to change the processing from individual sequental input to being able to input the old password and have it generate the new password in one input process. This will work, but be warned: Because you limit the password to a fixed length, only upper case alpha, no special characters, and use a simple substitution cipher, this will generate very weak passwords. #Include<Array.au3> ; Variables Global $Array = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9", ",") Global $alpha = StringSplit("X,M,H,G,T,R,S,P,C,W,J,F,W,B,Q,K,O,L,U,Z,D,A,V,Y,I,N,4,9,3,6,1,2,7,5,0,8", ",") Global $i = 0, $Input, $value = "", $Pos, $Output While 1 $Input = InputBox("Password Generator", "Input an Alpha/Numeric") If @error Then Exit Else If StringIsAlNum($Input) And StringLen($Input) = 12 Then ExitLoop Else MsgBox(16, "Error", "Password length must be 12 alpha-numeric characters") ContinueLoop EndIf EndIf WEnd $value = StringSplit($Input, "") For $i = 1 To $value[0] $Pos = _ArraySearch($Array, $value[$i], 1, 0, 0, True) $value[$i] = $alpha[$Pos] Next $Output = _ArrayToString($value, "", 1) MsgBox(64, "Password Converted", "Input = " & $Input & @CRLF & "Output = " & $Output) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
anixon Posted June 18, 2007 Author Share Posted June 18, 2007 (edited) This will work, but be warned: Because you limit the password to a fixed length, only upper case alpha, no special characters, and use a simple substitution cipher, this will generate very weak passwords. #Include<Array.au3> ; Variables Global $Array = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9", ",") Global $alpha = StringSplit("X,M,H,G,T,R,S,P,C,W,J,F,W,B,Q,K,O,L,U,Z,D,A,V,Y,I,N,4,9,3,6,1,2,7,5,0,8", ",") Global $i = 0, $Input, $value = "", $Pos, $Output While 1 $Input = InputBox("Password Generator", "Input an Alpha/Numeric") If @error Then Exit Else If StringIsAlNum($Input) And StringLen($Input) = 12 Then ExitLoop Else MsgBox(16, "Error", "Password length must be 12 alpha-numeric characters") ContinueLoop EndIf EndIf WEnd $value = StringSplit($Input, "") For $i = 1 To $value[0] $Pos = _ArraySearch($Array, $value[$i], 1, 0, 0, True) $value[$i] = $alpha[$Pos] Next $Output = _ArrayToString($value, "", 1) MsgBox(64, "Password Converted", "Input = " & $Input & @CRLF & "Output = " & $Output) Thanks for that it works fantastic thanks for the lesson. I have addressed your concerns about the strength of the password [code inserted] CODE#Include<Array.au3> #include<String.au3> ; Variables Global $Array = StringSplit("A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9", ",") Global $alpha = StringSplit("X,M,H,G,T,R,S,P,C,W,J,F,W,B,Q,K,O,L,U,Z,D,A,V,Y,I,N,4,9,3,6,1,2,7,5,0,8", ",") Global $i = 0, $Input, $value = "", $Pos, $Output While 1 $Input = InputBox("Password Generator", "Input an Alpha/Numeric Password") If @error Then Exit Else If StringIsAlNum($Input) And StringLen($Input) >= 6 And StringLen($Input) <= 12 Then ExitLoop Else MsgBox(16, "Input Error", "Password length must be 6-12 alpha-numeric characters") ContinueLoop EndIf EndIf WEnd While 1 $EncKey = InputBox("Password Generator", "Input an Alpha/Numeric Encryption Key") If @error Then Exit Else If StringIsAlNum($Input) And StringLen($Input) >= 6 And StringLen($Input) <= 12 Then ExitLoop Else MsgBox(16, "Input Error", "Encryption Key length must be 6-12 alpha-numeric characters") ContinueLoop EndIf EndIf WEnd $value = StringSplit($Input, "") For $i = 1 To $value[0] $Pos = _ArraySearch($Array, $value[$i], 1, 0, 0, True) $value[$i] = $alpha[$Pos] Next $Output = _ArrayToString($value, "", 1) $EPword = StringRight(_StringEncrypt(1, $Output, $EncKey, 1), Round(Random(6, 12), 0)) MsgBox(0, "Password Converted", "Input = " & $Input & @CRLF & @LF & "Output = " & $EPword) Thanks again Ant.... Edited June 18, 2007 by anixon Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now