Padding
Bindings for the padding API. See the libsodium padding docs for more information.
sodium_pad
var paddedLength = sodium.sodium_pad(buf, unpaddedLength, blocksize)
Pads buf with random data from index unpaddedLength up to closest multiple of blocksize.
bufmust be abufferunpaddedLengthmust be an integer at mostbuf.lengthblocksizemust be an integer greater than 1, but at mostbuf.length
Returns the length of the padded data (so you may .slice the buffer to here).
sodium_unpad
var unpaddedLength = sodium.sodium_unpad(buf, paddedLength, blocksize)
Calculates unpaddedLength from a padded buf with blocksize.
bufmust be abufferpaddedLengthmust be an integer at mostbuf.lengthblocksizemust be an integer greater than 1, but at mostbuf.length
Returns the length of the unpadded data (so you may .slice the buffer to here).
