* add `pack`/`unpack` helper functions between `&[bool]` and `u8`.
Extracted from 2c7f288932
Co-authored-by: Carlos Pérez <37264926+CPerezz@users.noreply.github.com>
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>
* write an initial 0x01 version byte, and check it on read;
* use little-endian byte order for lengths;
* add length fields before the selectors and the permutation commitments,
and check their consistency with the expected lengths on read;
* do not write an extra byte for a selector bit vector if the number of
bits is a multiple of 8;
* ensure that original I/O errors are preserved.
Signed-off-by: Daira Emma Hopwood <daira@jacaranda.org>