Generates variations of the string based on the brute force tactic.
Generates variations of the string based on the brute force tactic.
Rate Generates variations of the string based on the brute force tactic.
(1(1 Vote))
Private Function bf(CharSet As String, pwd As String)
Dim sLastChar As String
Dim i As Integer
sLastChar = Right(pwd, 1)
If String(Len(pwd), Right(CharSet, 1)) = pwd Then
bf = String(Len(pwd) + 1, Left(CharSet, 1))
Else
If sLastChar = Right(CharSet, 1) Then
bf = bf(CharSet, Left(pwd, Len(pwd) - 1)) & Left(CharSet, 1)
Else
For i = 1 To Len(CharSet)
If sLastChar = Mid(CharSet, i, 1) Then
sLastChar = Mid(CharSet, i + 1, 1)
Exit For
End If
Next
bf = Left(pwd, Len(pwd) - 1) & sLastChar
End If
End If
End Function
'This little peice of code I just wrote to demonstrate how it works. It will fill listbox with variations, starting with "A","B","C","AA","AB", etc. You get the point.
Private Sub Command2_Click()
Dim pwd As String
pwd = "A"
Do Until pwd = "AAAA"
Me.List1.AddItem pwd
pwd = (bf("ABC", pwd))
Loop
Me.List1.AddItem pwd
End Sub
Generates variations of the string based on the brute force tactic. Comments
No comments yet — be the first to post one!
Post a Comment