Question on PKCS7 Padding #1020
Unanswered
matthiasgeihs
asked this question in
Q&A
Replies: 1 comment 1 reply
-
it's 0 for bytes.count == blockSize, isn't it |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
CryptoSwift/Sources/CryptoSwift/PKCS/PKCS7Padding.swift
Lines 30 to 35 in db51c40
PKCS7 padding has an if branch that seems unreachable, if I see it correctly.
In the above example,
padding = blockSize - (bytes.count % blockSize)
.For
blockSize > 0
,blockSize
is strictly greatera % blockSize
, for any integera
.Hence,
padding
can never be zero.==> The branch
if padding == 0
should be removed.Right?
(Might relate to #953.)
Beta Was this translation helpful? Give feedback.
All reactions