title: Java DES encryption with CBC gives different results each time it is run
body: <p>I'm trying to use JDK 1.7 JCE (Windows 7 x64) to perform Single DES encryption with CBC on a small block.  Each time I run the program below I get different results.  The key is the same, the data is the same, what could be wrong?</p>
  
  <pre><code>public class CBCTest {
      public static void main(String[] args) throws Exception {
          Cipher cc = Cipher.getInstance("DES/CBC/NoPadding");
          Key k = new SecretKeySpec(new byte[] {1,1,1,1,1,1,1,1}, "DES");
          cc.init(Cipher.ENCRYPT_MODE, k);
          byte[] data = new byte[]{1,2,3,4,5,6,7,8};
          cc.doFinal(data);
          System.out.println("Encrypted: " + Arrays.toString(cc.doFinal(data)));
      }
  }
  </code></pre>
  
  <p>Edit:
  Changing the  Cipher mode to ECB <code>"DES/CBC/NoPadding"</code> works without a problem.</p>