-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/pkcs7 padding #406
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #406 +/- ##
=======================================
Coverage 95.90% 95.90%
=======================================
Files 221 222 +1
Lines 9200 9258 +58
=======================================
+ Hits 8823 8879 +56
- Misses 377 379 +2
☔ View full report in Codecov by Sentry. |
the naming convention change to Pkcs7Padding to me seems less readable than the PKCS7Padding, but I will change it to appease codacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks! As for the naming convention, it's a common convention to only capitalize the first letter of an acronym (e.g., https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.aes?view=net-7.0)
This pull request introduces a new class that implements the PKCS7 padding algorithm. The class provides three main methods:
AddPadding
,RemovePadding
, andGetPaddingSize
.AddPadding
: This method adds padding to the end of a byte array according to the PKCS#7 standard.RemovePadding
: This method removes the PKCS7 padding from the given input data.GetPaddingSize
: This method gets the number of padding bytes in the given input data according to the PKCS7 padding scheme.The implementation uses bitwise operations to avoid branching, which can lead to more efficient code execution,and avoid timing attacks.
In addition, a new folder structure Crypto/Padding has been created for this implementation, as the current structure didn’t have any relevant folder for this implementation.