فهرست منبع

Fix PKCS7 for large input data

Marcin Krzyżanowski 10 سال پیش
والد
کامیت
245e77b6cd
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      CryptoSwift/PKCS7.swift

+ 1 - 1
CryptoSwift/PKCS7.swift

@@ -15,7 +15,7 @@ public struct PKCS7: Padding {
     }
     
     public func add(bytes: [UInt8] , blockSize:Int) -> [UInt8] {
-        var padding = UInt8(blockSize) - (UInt8(bytes.count) % UInt8(blockSize))
+        var padding = UInt8(blockSize - (bytes.count % blockSize))
         var withPadding = bytes
         if (padding == 0) {
             // If the original data is a multiple of N bytes, then an extra block of bytes with value N is added.