title: String pattern/algorithm for PIN & PUK generated from MSIN
body: <p>I wonder how mobile phone companies generate both PIN and PUK for their SIM cards?</p>
  
  <p>I have a large database of already generated codes, this database contains 3 columns:
  * MSIN : Mobile Subscriber Identification Number (10 digits)
  * PIN : Personal Identification Number  (4 digits)
  * PUK : Personal Unblocking Code  (8 digits)</p>
  
  <p>So far, maybe both PIN and PUK are generated from MSIN because the MSIN column is incrementing, while others, are generated with a logic, something like;</p>
  
  <pre>
  MSIN            PIN     PUK  
  1000000000      3234    20005627  
  1000000001      5993    92870018  
  1000000002      3465    30327846  
  ...
  </pre>
  
  <p>is it possible to know how this serials are generated? Using the existing database is it possible to guess the algo used?</p>
  
  <p>I'm asking this for the sake of knowledge only not to use the provided information in any illegal activity  ;)</p>
  
  <p>thanx.</p>
  
  <h1>UPDATE</h1>
  
  <p>I searched for how many times some pin codes are repeated and found this</p>
  
  <pre>
  0000 –> 261 times
  1111 –> 429982 times
  2222 –> 275
  3333 –> 233
  4444 –> 279
  5555 –> 277
  6666 –> 242
  7777 –> 263
  8888 –> 249
  9999 –> 242
  </pre>
  
  <p>the pin 1111 is used more than others! so maybe the algo is changed from time to time.. or ther's no logic at all inside :(</p>
  
  <h1>UPDATE 2</h1>
  
  <p>I checked the MSIN and found that they make jumps in the incrementing system, so for example;</p>
  
  <pre>
  1011000000
  1011000001
  …              here they followed incrementing until 1011499999     
  1011499999     and they jumped to 1031000000
  1031000000
  …              the same thing here
  1031299999
  1131000000
  … 
  </pre>
  
  <p>this leads to an idea that whenever they want to issue new cards, lets say 500 000 cards, they start with a new MSIN that doesn't follow the incrementing rule in the database and the may change the algo behind the code generation (that's why we find in some cases they issued all the next cards with pin 1111)</p>