Explorar o código

Fixes invalid result value on device. Fixes #57

Marcin Krzyżanowski %!s(int64=10) %!d(string=hai) anos
pai
achega
f146411a7c
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      CryptoSwift/PKCS7.swift

+ 2 - 1
CryptoSwift/PKCS7.swift

@@ -35,7 +35,8 @@ public struct PKCS7: Padding {
     }
     
     public func remove(bytes: [UInt8], blockSize:Int? = nil) -> [UInt8] {
-        var padding = Int(bytes.last!) // last byte
+        let lastByte = bytes.last!
+        var padding = Int(lastByte) // last byte
         
         if padding >= 1 { //TODO: need test for that, what about empty padding
             return Array(bytes[0..<(bytes.count - padding)])