Can someone explain how this Excel 2010 or earlier password protector works












1














Can someone please explain how this works, why do i need counts of 65 to 66, where are there 12 counts and what do all the Chr(variable) give?



I'm not trying to code this, but i did find this on the web when someone asked how to unlock their sheet after they forgot their password. I would like to understand what is actually happening



Sub PasswordBreaker()

Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox "One usable password is " & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub


Thank You










share|improve this question



























    1














    Can someone please explain how this works, why do i need counts of 65 to 66, where are there 12 counts and what do all the Chr(variable) give?



    I'm not trying to code this, but i did find this on the web when someone asked how to unlock their sheet after they forgot their password. I would like to understand what is actually happening



    Sub PasswordBreaker()

    Dim i As Integer, j As Integer, k As Integer
    Dim l As Integer, m As Integer, n As Integer
    Dim i1 As Integer, i2 As Integer, i3 As Integer
    Dim i4 As Integer, i5 As Integer, i6 As Integer
    On Error Resume Next
    For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
    For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
    For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
    For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
    ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
    Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
    Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
    If ActiveSheet.ProtectContents = False Then
    MsgBox "One usable password is " & Chr(i) & Chr(j) & _
    Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
    Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
    Exit Sub
    End If
    Next: Next: Next: Next: Next: Next
    Next: Next: Next: Next: Next: Next
    End Sub


    Thank You










    share|improve this question

























      1












      1








      1







      Can someone please explain how this works, why do i need counts of 65 to 66, where are there 12 counts and what do all the Chr(variable) give?



      I'm not trying to code this, but i did find this on the web when someone asked how to unlock their sheet after they forgot their password. I would like to understand what is actually happening



      Sub PasswordBreaker()

      Dim i As Integer, j As Integer, k As Integer
      Dim l As Integer, m As Integer, n As Integer
      Dim i1 As Integer, i2 As Integer, i3 As Integer
      Dim i4 As Integer, i5 As Integer, i6 As Integer
      On Error Resume Next
      For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
      For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
      For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
      For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
      ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
      Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
      Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
      If ActiveSheet.ProtectContents = False Then
      MsgBox "One usable password is " & Chr(i) & Chr(j) & _
      Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
      Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
      Exit Sub
      End If
      Next: Next: Next: Next: Next: Next
      Next: Next: Next: Next: Next: Next
      End Sub


      Thank You










      share|improve this question













      Can someone please explain how this works, why do i need counts of 65 to 66, where are there 12 counts and what do all the Chr(variable) give?



      I'm not trying to code this, but i did find this on the web when someone asked how to unlock their sheet after they forgot their password. I would like to understand what is actually happening



      Sub PasswordBreaker()

      Dim i As Integer, j As Integer, k As Integer
      Dim l As Integer, m As Integer, n As Integer
      Dim i1 As Integer, i2 As Integer, i3 As Integer
      Dim i4 As Integer, i5 As Integer, i6 As Integer
      On Error Resume Next
      For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
      For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
      For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
      For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
      ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
      Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
      Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
      If ActiveSheet.ProtectContents = False Then
      MsgBox "One usable password is " & Chr(i) & Chr(j) & _
      Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
      Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
      Exit Sub
      End If
      Next: Next: Next: Next: Next: Next
      Next: Next: Next: Next: Next: Next
      End Sub


      Thank You







      excel vba excel-vba






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 at 11:10









      Mike Hill

      488




      488
























          1 Answer
          1






          active

          oldest

          votes


















          4














          This will generate multiple 12 character long passwords like AAAAAAAAAAA or AAAAAAAAAABA and so on and try if they work to unprotect the worksheet.



          The Chr function Chr(65) gives you the character with the ASCII code 65 which is an A. So actually the loops produce all permutations of A and B for the first 11 characters and the last loop has some more characters from ASCII 32 to 126 for the 12ᵗʰ character of the password.



          Because the old Excel version uses a not secure hash function to store the password there is more than one password to produce the same hash. So that's just a cheap way to find one of the passwords that work.



          For more detailed info see: Understanding Excel's Password Security Methodology






          share|improve this answer























          • Thank you for your explanation, really helped
            – Mike Hill
            22 hours ago











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410859%2fcan-someone-explain-how-this-excel-2010-or-earlier-password-protector-works%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          4














          This will generate multiple 12 character long passwords like AAAAAAAAAAA or AAAAAAAAAABA and so on and try if they work to unprotect the worksheet.



          The Chr function Chr(65) gives you the character with the ASCII code 65 which is an A. So actually the loops produce all permutations of A and B for the first 11 characters and the last loop has some more characters from ASCII 32 to 126 for the 12ᵗʰ character of the password.



          Because the old Excel version uses a not secure hash function to store the password there is more than one password to produce the same hash. So that's just a cheap way to find one of the passwords that work.



          For more detailed info see: Understanding Excel's Password Security Methodology






          share|improve this answer























          • Thank you for your explanation, really helped
            – Mike Hill
            22 hours ago
















          4














          This will generate multiple 12 character long passwords like AAAAAAAAAAA or AAAAAAAAAABA and so on and try if they work to unprotect the worksheet.



          The Chr function Chr(65) gives you the character with the ASCII code 65 which is an A. So actually the loops produce all permutations of A and B for the first 11 characters and the last loop has some more characters from ASCII 32 to 126 for the 12ᵗʰ character of the password.



          Because the old Excel version uses a not secure hash function to store the password there is more than one password to produce the same hash. So that's just a cheap way to find one of the passwords that work.



          For more detailed info see: Understanding Excel's Password Security Methodology






          share|improve this answer























          • Thank you for your explanation, really helped
            – Mike Hill
            22 hours ago














          4












          4








          4






          This will generate multiple 12 character long passwords like AAAAAAAAAAA or AAAAAAAAAABA and so on and try if they work to unprotect the worksheet.



          The Chr function Chr(65) gives you the character with the ASCII code 65 which is an A. So actually the loops produce all permutations of A and B for the first 11 characters and the last loop has some more characters from ASCII 32 to 126 for the 12ᵗʰ character of the password.



          Because the old Excel version uses a not secure hash function to store the password there is more than one password to produce the same hash. So that's just a cheap way to find one of the passwords that work.



          For more detailed info see: Understanding Excel's Password Security Methodology






          share|improve this answer














          This will generate multiple 12 character long passwords like AAAAAAAAAAA or AAAAAAAAAABA and so on and try if they work to unprotect the worksheet.



          The Chr function Chr(65) gives you the character with the ASCII code 65 which is an A. So actually the loops produce all permutations of A and B for the first 11 characters and the last loop has some more characters from ASCII 32 to 126 for the 12ᵗʰ character of the password.



          Because the old Excel version uses a not secure hash function to store the password there is more than one password to produce the same hash. So that's just a cheap way to find one of the passwords that work.



          For more detailed info see: Understanding Excel's Password Security Methodology







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 21 at 12:34

























          answered Nov 21 at 11:19









          Pᴇʜ

          20.2k42650




          20.2k42650












          • Thank you for your explanation, really helped
            – Mike Hill
            22 hours ago


















          • Thank you for your explanation, really helped
            – Mike Hill
            22 hours ago
















          Thank you for your explanation, really helped
          – Mike Hill
          22 hours ago




          Thank you for your explanation, really helped
          – Mike Hill
          22 hours ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410859%2fcan-someone-explain-how-this-excel-2010-or-earlier-password-protector-works%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          404 Error Contact Form 7 ajax form submitting

          How to know if a Active Directory user can login interactively

          TypeError: fit_transform() missing 1 required positional argument: 'X'