|
|
@@ -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)
|
|
|
|