title: How key_derivation and key_verification functions are implemented of a 7-zip archive's encryption mechanism?
body: <p>I am curious about how password recovery works for password protected files. <code>And I want to know the exact flow of the 7-zip encryption mechanism.</code></p>
  
  <p><code>7-zip</code> uses AES-256 encryption algorithm in CBC mode, to encrypt files or a folder. The key is generated from user supplied pass-phrase based on SHA-256 hash function. The SHA-256 is executed 2<sup>19</sup> (524,288) times to increase the cost of exhaustive search. Also, to help reduce the risk of dictionary attacks, salt is appended to original pass-phrase before generating hash.</p>
  
  <p>My First question is <code>how does key_derivation function work to generate a 256-bit key</code> ? What is importance of IV for AES CBC mode and how it is generated? </p>
  
  <p>My second and <code>most important question</code> is how key is verified to decrypt the 7-zip archive ? I mean how does its key_verification function work ?</p>