in Crypto SDK factorize bitpacking formats between packing and unpacking

Add a way to declare a packing format once and give it to both packer and unpacker, to improve readability and robustness.