LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Loop Training: Password Finder


I am teaching myself VBA. To learn how to write lopps I have challenged
myself to do the following:

A macro that cracks a password. I have a macro below, but please let
me know if any of you can come up with a quicker way to search the
various strings (beyond the obvious of "Application.ScreenUpdating =
False").

So here is the challenge:

In the workbook:
Cell A1 contains the 7-digit password, say "eureka" (this is the
password I want the macro to find)
Cell A2 is blank (this is the cell I want the macro to test strings)


Note:
- This macro will look only for a 7-digit password, which password
shall be in lower-case letters only (the lowercase alphabet = Chr(97)
through Chr (122))
- This macro will also display the time the search begins and stops.

Here is my first try at a macro to hack the password:
_______________
Sub passwordsearch()
'
' 7 DIGIT SEARCH
'
Dim a As Integer, b As Integer, c As Integer
Dim d As Integer, e As Integer, f As Integer, g As Integer
Dim Crack As String
Range("a5").Value = "Start: " & Now()
On Error Resume Next
If Range("A2").Value < Range("A1").Value Then
Do
For a = 97 To 122: For b = 97 To 122: For c = 97 To 122
For d = 97 To 122: For e = 97 To 122: For f = 97 To 122: For g
= 97 To 122
Crack = Chr(a) & Chr(b) & Chr(c) & Chr(d) & Chr(e) & Chr(f) &
Chr(g)
Range("A2").Value = Crack
If Range("A2").Value = Range("A1").Value Then
With Range("a6")
..Value = "Stop: " & Now()
End With
Exit Sub
End If
Next: Next: Next: Next: Next: Next: Next
Loop
End If
End Sub
___________________

I launch this macro from a button on the worksheet. Any
reccomendations are appreciated!

-- Jason


--
jasonsweeney
------------------------------------------------------------------------
jasonsweeney's Profile: http://www.excelforum.com/member.php...fo&userid=5222
View this thread: http://www.excelforum.com/showthread...hreadid=393619

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the range finder and how do you use it? Angeleyez Excel Discussion (Misc queries) 2 March 6th 07 07:10 PM
Number Combination finder GMD Excel Worksheet Functions 2 September 8th 06 05:14 PM
Rnage Finder JosephC Excel Worksheet Functions 1 February 21st 06 12:33 AM
Complex adjacent row value finder - need help Tom Ogilvy Excel Programming 0 April 18th 05 12:36 PM
Password Loop question. Andy Tallent Excel Discussion (Misc queries) 1 April 8th 05 01:16 PM


All times are GMT +1. The time now is 12:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"