unpad static method

Uint8List unpad(
  1. Uint8List buf,
  2. int blockSize
)

Implementation

static Uint8List unpad(Uint8List buf, int blockSize) {
  final _buf = buf.toPointer();
  final _unpaddedlen = calloc<Uint32>(1);
  try {
    _sodium
        .sodium_unpad(_unpaddedlen, _buf, buf.length, blockSize)
        .mustSucceed('sodium_unpad');

    return _buf.toList(_unpaddedlen[0]);
  } finally {
    calloc.free(_buf);
    calloc.free(_unpaddedlen);
  }
}