mirror of
https://github.com/krzyzanowskim/CryptoSwift.git
synced 2026-06-06 20:17:32 +00:00
assert checked too early
This commit is contained in:
@@ -37,11 +37,12 @@ public struct PKCS7: Padding {
|
||||
}
|
||||
|
||||
public func remove(data bytes: Array<UInt8>, blockSize:Int?) -> Array<UInt8> {
|
||||
assert(!bytes.isEmpty, "Need bytes to remove padding")
|
||||
guard !bytes.isEmpty, let lastByte = bytes.last else {
|
||||
return bytes
|
||||
}
|
||||
|
||||
assert(!bytes.isEmpty, "Need bytes to remove padding")
|
||||
|
||||
let padding = Int(lastByte) // last byte
|
||||
let finalLength = bytes.count - padding
|
||||
|
||||
|
||||
Reference in New Issue
Block a user