Browse Source

Use BytesSequence in place of .chunks()

Marcin Krzyżanowski 9 years ago
parent
commit
e8993082b5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      Sources/CryptoSwift/ChaCha20.swift

+ 2 - 2
Sources/CryptoSwift/ChaCha20.swift

@@ -165,7 +165,7 @@ extension ChaCha20 {
 
             var encrypted = Array<UInt8>()
             encrypted.reserveCapacity(self.accumulated.count)
-            for chunk in self.accumulated.chunks(size: ChaCha20.blockSize) {
+            for chunk in BytesSequence(chunkSize: ChaCha20.blockSize, data: self.accumulated) {
                 if (isLast || self.accumulated.count >= ChaCha20.blockSize) {
                     encrypted += try chacha.encrypt(chunk)
                     self.accumulated.removeFirst(chunk.count)
@@ -201,7 +201,7 @@ extension ChaCha20 {
 
             var plaintext = Array<UInt8>()
             plaintext.reserveCapacity(self.accumulated.count)
-            for chunk in self.accumulated.chunks(size: ChaCha20.blockSize) {
+            for chunk in BytesSequence(chunkSize: ChaCha20.blockSize, data: self.accumulated) {
                 if (isLast || self.accumulated.count >= ChaCha20.blockSize) {
                     plaintext += try chacha.decrypt(chunk)