Skip to content
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

[Bug]: HasPadding edge-case #188

Open
ShortDevelopment opened this issue Jan 12, 2025 · 0 comments
Open

[Bug]: HasPadding edge-case #188

ShortDevelopment opened this issue Jan 12, 2025 · 0 comments
Assignees
Labels
area::libCdp All things related to the custom implementation type::bug Something isn't working

Comments

@ShortDevelopment
Copy link
Member

ShortDevelopment commented Jan 12, 2025

HasPadding fails if last byte of plainText equals 1 or 0 but has no padding.

static bool HasPadding(ReadOnlySpan<byte> buffer, out byte paddingSize)
{
paddingSize = buffer[^1];
for (int i = buffer.Length - paddingSize; i < buffer.Length; i++)
{
if (paddingSize != buffer[i])
return false;
}
return true;
}

@ShortDevelopment ShortDevelopment added type::bug Something isn't working area::libCdp All things related to the custom implementation labels Jan 12, 2025
@ShortDevelopment ShortDevelopment self-assigned this Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area::libCdp All things related to the custom implementation type::bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

1 participant