Class SecurePadding
- Namespace
- LibSodium
- Assembly
- LibSodium.Net.dll
Provides methods for padding and unpadding byte buffers to ensure they meet specified block sizes.
public static class SecurePadding
- Inheritance
-
SecurePadding
- Inherited Members
Methods
Pad(Span<byte>, int, int)
Pads the given buffer to the specified block size.
public static Span<byte> Pad(Span<byte> buffer, int unpaddedLen, int blockSize)
Parameters
buffer
Span<byte>The buffer to pad.
unpaddedLen
intThe length of the data before padding.
blockSize
intThe block size to pad to.
Returns
Exceptions
- ArgumentException
Thrown when blockSize is less than or equal to 0 or unpaddedLen is greater than buffer length.
Unpad(Span<byte>, int)
Unpads the given buffer that was padded to a specified block size.
public static Span<byte> Unpad(Span<byte> buffer, int blockSize)
Parameters
Returns
Exceptions
- ArgumentException
Thrown when blockSize is less than or equal to 0.
- LibSodiumException
Thrown when unpadding fails.