|
@@ -37,11 +37,12 @@ public struct PKCS7: Padding {
|
|
}
|
|
}
|
|
|
|
|
|
public func remove(bytes: Array<UInt8>, blockSize:Int?) -> Array<UInt8> {
|
|
public func remove(bytes: Array<UInt8>, blockSize:Int?) -> Array<UInt8> {
|
|
- assert(!bytes.isEmpty, "Need bytes to remove padding")
|
|
|
|
guard !bytes.isEmpty, let lastByte = bytes.last else {
|
|
guard !bytes.isEmpty, let lastByte = bytes.last else {
|
|
return bytes
|
|
return bytes
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ assert(!bytes.isEmpty, "Need bytes to remove padding")
|
|
|
|
+
|
|
let padding = Int(lastByte) // last byte
|
|
let padding = Int(lastByte) // last byte
|
|
let finalLength = bytes.count - padding
|
|
let finalLength = bytes.count - padding
|
|
|
|
|