The complexity of a password
The effectiveness of a password is largely by the number of possible combinations. But the catch is that the user rests his confidence by the simple fact that the possible combinations are high. At what level can we say that the number of combinations is really high.
An example will illustrate the point. At the lottery 6/49 (in Canada), you must choose a combination of 6 numbers between 1 and 49. The formula is simple and it is a form factor:
The factorial is expressed by an exclamation mark "! ".
(N!) / (N-6)? = (N) * (n-1) * (n-2) * (n-3) .... 1 / [(n-6) * (n-5) * (n-4) ....]
If n = 49, then it gives you: 49 * 48 * 47 * 46 * 45 * 44 = 10 068 347 520 (10 million possibilities)
But since the draft order does not matter, you need to June 1 factorial:
6 * 5 * 4 * 3 * 2 * 1 = 720
So you have to divide the number of possible combination divided by 6 factorial = 10068347520/720 = 13983816 = 13 million.
In light of the theory presented small, is what it is conceivable that a person could consider a password of 6 digits is safe enough? You as well as I guess that despite the fact that there are nearly 10 million possibilities in the case of a draw without replacement with 49 possibilities, a password consists of 6 digits is considered very low. You probably douterez detection software that passwords will surely be able to find the password almost instantly.
Now back to our reality passwords. Regardless opportunities characters (0 to 9, a to z, A to Z, ...) we must know the password chosen does not necessarily have a length of 6. It can be any length (or more). In addition, characters can be reused in the password (eg "000000"). In probability, reuse is called surrender. The number of possibilities increases more or less significant. Observe the following reasoning if only single digit (0-9):
Passwords one character: 10 opportunities
Passwords 2 characters: 10 * 10 opportunities
Passwords 3 characters: 10 * 10 * 10 possibilities
Password of 4 characters: 10 * 10 * 10 * 10 opportunities
Passwords 5 characters: 10 * 10 * 10 * 10 * 10 opportunities
Password of 6 characters: 10 * 10 * 10 * 10 * 10 * 10 opportunities
10 + 10 ^ 2 + 10 ^ 3 + 10 ^ 4 + 10 ^ 5 + 10 ^ 6 = 10 + 100 + 1000 + 10 000 + 100 000 +1 000 000 = 1 111 110 options.
So just over 1 million possibilities.
Here, I made a small computer program that highlights the possible combinations of a password with a length of 5 and displays at the same time the processing time. I chose the maximum value of 5 because the program can complete his generation opportunities more quickly than if the password was 6. Moreover, the source code is available for download and you are free to modify to your liking. I want to warn you that the treatment for a password with a length of 5 takes about 15 seconds on my machine. The same treatment for a password length of 6 takes 3 minutes. My computer has the following specifications:
OS Name: Microsoft Windows 7 Professional
System Type: x64-based PC
Processor: Intel ® Core ™ i7-2670QM CPU2.2GHz, 2201 Mhz, 4 Core (s), 8 Logical Processor (s)
Installed Physical Memory (RAM): 8.00 GB
Press the END button on the ListBox1 to reach the last element of the list.
Here is a copy of the code that enables the generation of possibilities according to the logic presented in this paper, ie 0-9, 00-99, 000-999, 0000-9999, 00000-99999, 000000 to 999999. I insist on the fact that the mathematical formula presented earlier corresponds perfectly to computer code developed in Visual Basic Dot Net.
Private Function CheckLetter1() Dim index1 As Integer Dim index2 As Integer Dim index3 As Integer Dim index4 As Integer Dim index5 As Integer Dim index6 As Integer Dim found As Boolean Dim date1 As Date Dim date2 As Date Dim checker As String date1 = DateTime.Now found = False If NumericUpDown1.Value >= 1 Then 'look for numbers 1st level For index1 = 0 To 9 Step 1 'recherche des chiffres checker = Microsoft.VisualBasic.ChrW(48 + index1) ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next End If If NumericUpDown1.Value >= 2 Then 'look for numbers 2nd level For index1 = 0 To 9 Step 1 'recherche des chiffres For index2 = 0 To 9 Step 1 'recherche des chiffres checker = index1.ToString & index2.ToString ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next Next End If If NumericUpDown1.Value >= 3 Then 'look for numbers 3rd level For index1 = 0 To 9 Step 1 'recherche des chiffres For index2 = 0 To 9 Step 1 'recherche des chiffres For index3 = 0 To 9 Step 1 'recherche des chiffres checker = index1.ToString & index2.ToString & index3.ToString ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next Next Next End If If NumericUpDown1.Value >= 4 Then 'look for numbers 4th level For index1 = 0 To 9 Step 1 'recherche des chiffres For index2 = 0 To 9 Step 1 'recherche des chiffres For index3 = 0 To 9 Step 1 'recherche des chiffres For index4 = 0 To 9 Step 1 'recherche des chiffres checker = index1.ToString & index2.ToString & index3.ToString & index4.ToString ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next Next Next Next End If If NumericUpDown1.Value >= 5 Then ''look for numbers 5th level For index1 = 0 To 9 Step 1 'recherche des chiffres For index2 = 0 To 9 Step 1 'recherche des chiffres For index3 = 0 To 9 Step 1 'recherche des chiffres For index4 = 0 To 9 Step 1 'recherche des chiffres For index5 = 0 To 9 Step 1 'recherche des chiffres checker = index1.ToString & index2.ToString & index3.ToString & index4.ToString & index5.ToString ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next Next Next Next Next End If If NumericUpDown1.Value >= 6 Then ''look for numbers 6th level For index1 = 0 To 9 Step 1 'recherche des chiffres For index2 = 0 To 9 Step 1 'recherche des chiffres For index3 = 0 To 9 Step 1 'recherche des chiffres For index4 = 0 To 9 Step 1 'recherche des chiffres For index5 = 0 To 9 Step 1 'recherche des chiffres For index6 = 0 To 9 Step 1 'recherche des chiffres checker = index1.ToString & index2.ToString & index3.ToString & index4.ToString & index5.ToString & index6.ToString ListBox1.Items.Add(checker) If TextBox1.Text = checker Then TextBox2.Text = checker found = True End If Next Next Next Next Next Next End If date2 = DateTime.Now ' date2.Subtract(date1).ToString ToolStripStatusLabel1.Text = "Finished. " & date2.Subtract(date1).ToString & " and ListBox1 Count: " & ListBox1.Items.Count Return 0 End Function |
We understand that the process is extremely repetitive and there is no intelligence in code. The goal is simply to introduce the concept and nature of the problem.
In a future article, I'll maybe use a more elegant approach a computational point of view is called recursion. While some familiar recursion as a tool of choice, we see that in our case, it can be bad.
Read the first series of this item: Password programming for beginners
Read the previous article in the series of this article: Password programming for beginners (Part 2)
0 Response to "The complexity of a password"
Posting Komentar