title: iOS:CCCrypt() Which is more secure kCCOptionECBMode or kCCModeCBC
body: <pre><code>//Stateless, one-shot encrypt operation
  CCCryptorStatus cryptStatus = CCCrypt(
      kCCEncrypt,          //Operation Encrypt or Decrypt
      kCCAlgorithmAES128,  //Encrypt algorithm to be used
      kCCOptionPKCS7Padding | kCCOptionECBMode,
      keyPtr,
      kCCBlockSizeAES128,  //Key length
      nil,                 //In ECB mode ignored
      [datainput bytes],   //Data to encrypt
      dataLength,          //Length of data
      buffer,              //Data after encrypt
      bufferSize,          //Size of data after encrypt
      &amp;numBytesEncrypted); //Onsuccess no.of bytes written
  </code></pre>
  
  <p>I have a file I want to encrypt it and I am making use of above function. Encryption and decryption is working perfectly fine!</p>
  
  <p>But my concern is: there is option in cccrypt() to make use of default CBC mode or specify ECB mode. I am making use of ECB mode, so if I use CBC mode with IV then will it provide more secure encryption?</p>
  
  <p>In short which one should I use default CBC mode or ECB mode? and why?</p>
  
  <p>And what about IV?
  does specifying IV a longer string makes encryption more secure and random?
  for ECB mode it will be ignored. If i make use of CBC mode so what should be IV? please provide an example it would be helpful.</p>
  
  <p>Should IV be same for encryption and decryption of same file? or can be different IV?</p>
  
  <p>And what about key?
  length I am using is 128, algorithm: AES</p>
  
  <p>key I have used is: @"ltd@mpc"</p>
  
  <p>Is it strong? or should I make use of key: 0xfedcba9876543210 something like this?</p>