浏览代码

Fixing array slice problem

Nathan Fallet 4 年之前
父节点
当前提交
344c508c64
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Sources/CryptoSwift/BlockMode/CFB.swift

+ 2 - 2
Sources/CryptoSwift/BlockMode/CFB.swift

@@ -75,7 +75,7 @@ struct CFBModeWorker: BlockModeWorker {
         guard let ciphertext = cipherOperation(prev ?? iv) else {
           return Array(plaintext)
         }
-        self.prev = (prev ?? iv)[1...] + [plaintext[i] ^ ciphertext[0]]
+        self.prev = Array((prev ?? iv).dropFirst()) + [plaintext[i] ^ ciphertext[0]]
       }
       return Array(self.prev ?? [])
     }
@@ -99,7 +99,7 @@ struct CFBModeWorker: BlockModeWorker {
         guard let plaintext = cipherOperation(prev ?? iv) else {
           return Array(ciphertext)
         }
-        self.prev = (prev ?? iv)[1...] + [ciphertext[i]]
+        self.prev = Array((prev ?? iv).dropFirst()) + [ciphertext[i]]
         result.append(ciphertext[i] ^ plaintext[0])
       }
       return result