Browse Source

improve readability per Marcin's comment

Evan Maloney 9 years ago
parent
commit
b698dfc8e1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Sources/CryptoSwift/Rabbit.swift

+ 3 - 1
Sources/CryptoSwift/Rabbit.swift

@@ -176,8 +176,9 @@ final public class Rabbit {
         
         var result = [UInt8](count: bytes.count, repeatedValue: 0)
         var output = nextOutput()
+        var byteIdx = 0
         var outputIdx = 0
-        for byteIdx in 0 ..< bytes.count {
+        while byteIdx < bytes.count {
             if (outputIdx == Rabbit.blockSize) {
                 output = nextOutput()
                 outputIdx = 0
@@ -185,6 +186,7 @@ final public class Rabbit {
             
             result[byteIdx] = bytes[byteIdx] ^ output[outputIdx]
 
+            byteIdx += 1
             outputIdx += 1
         }
         return result