瀏覽代碼

Fix decrypt for CBC in case IV is longer than block size. #32

Marcin Krzyżanowski 11 年之前
父節點
當前提交
3d7ce7933b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      CryptoSwift/CipherBlockMode.swift

+ 1 - 1
CryptoSwift/CipherBlockMode.swift

@@ -111,7 +111,7 @@ private struct CBCMode {
         for (idx,ciphertext) in enumerate(blocks) {
             if let decrypted = cipher(block: ciphertext) { // decrypt
                 
-                var xored:[UInt8] = [UInt8](count: lastCiphertext.count, repeatedValue: 0)
+                var xored:[UInt8] = [UInt8](count: ciphertext.count, repeatedValue: 0)
                 for i in 0..<ciphertext.count {
                     xored[i] = lastCiphertext[i] ^ decrypted[i]
                 }