Interface Padding.Native
- All Known Implementing Classes:
LazySodium,LazySodiumJava
- Enclosing interface:
- Padding
public static interface Padding.Native
-
Method Summary
Modifier and TypeMethodDescriptionbooleansodiumPad(com.sun.jna.ptr.IntByReference paddedBuffLen, com.sun.jna.Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen) Adds extra padding to a bufferbufwhose original size isunpaddedBufLenin order to extend its total length to a multiple ofblocksize.booleansodiumUnpad(com.sun.jna.ptr.IntByReference unpaddedBufLen, com.sun.jna.Pointer buf, int paddedBufLen, int blockSize) Computes the original, unpadded length of a message previously padded usingsodiumPad(IntByReference, Pointer, int, int, int).
-
Method Details
-
sodiumPad
boolean sodiumPad(com.sun.jna.ptr.IntByReference paddedBuffLen, com.sun.jna.Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen) Adds extra padding to a bufferbufwhose original size isunpaddedBufLenin order to extend its total length to a multiple ofblocksize.- Parameters:
paddedBuffLen- New length of buffer.buf- The buffer byte array.unpaddedBufLen- The length ofbufwith no padding.blockSize- Block size.maxBufLen- The absolute maximum you want this buffer length to be.- Returns:
- False if the padded buffer length would exceed
maxBufLen.
-
sodiumUnpad
boolean sodiumUnpad(com.sun.jna.ptr.IntByReference unpaddedBufLen, com.sun.jna.Pointer buf, int paddedBufLen, int blockSize) Computes the original, unpadded length of a message previously padded usingsodiumPad(IntByReference, Pointer, int, int, int). The original length is put intounpaddedBufLen.- Parameters:
unpaddedBufLen- This will be populated with the unpadded buffer length.buf- The buffer.paddedBufLen- The padded buffer size.blockSize- The block size.- Returns:
- True if the buffer was unpadded.
-