title: How does Excel's worksheet password protection work
body: <p>This code has been floating around the net for quite a few years - it's apparently able to provide a password for decrypting an excel spreadsheet that you don't know the password to.</p>
  
  <p><a href="http://www.theofficeexperts.com/VBASamples/Excel02.htm" rel="noreferrer">http://www.theofficeexperts.com/VBASamples/Excel02.htm</a></p>
  
  <p>I'm interested in how this works but I don't seem to be able to work it out. I'm assuming it's encrypted under a certain value that can be gotten to in a number of ways (a few places on the net say it'll give you the original password or another one that will work) sort of like a public key - you can have 100 public keys that all work with a single private one.</p>
  
  <p>To me it seems like it's creating integer variables and filling them with a specific number, before turning that number into the relevant characters. Wouldn't these always be the same? If so, is there "master password" for Excel protection?</p>
  
  <p>Thanks all!</p>
  
  <p>EDIT: I've noticed the <em>For n = 32 To 126</em> in the example code I posted. Cross referencing with an ASCII table that seems to be all characters from space through to tilde. Is this some sort of dictionary attack I'm not understanding due to syntax?</p>