Padding with a one and zeros #
BitString.pad10star r msg appends to a bit list a 1 and then the fewest zeros that make its
length a multiple of r: the padding m ↦ m ‖ 1 ‖ 0^* of the sponge construction
([KL20], Construction 7.6), called pad10* in the Keccak literature. Padding and then
cutting into blocks of r bits (BitString.toBlocks) is injective
(BitString.toBlocks_pad10star_injective), so a bit list of any length can be recovered from its
padded blocks.
Main definitions #
Cslib.BitString.pad10star: the paddingm ‖ 1 ‖ 0^*to a multiple ofrbits.
Main results #
Cslib.BitString.pad10star_injective,Cslib.BitString.toBlocks_pad10star_injective: distinct bit lists have distinct paddings and distinct padded block sequences.Cslib.BitString.length_pad10star: the padded length is(msg.length / r + 1) * r, one block more than the whole blocks of the message.Cslib.BitString.getD_pad10star: the padded list read with defaultfalseismsg ++ [true]read with defaultfalse.Cslib.BitString.toBlocks_pad10star_append_ofFn: the padded blocks of whole blocks followed by one more block.
References #
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, Construction 7.6
Padding is injective: distinct messages have distinct padded strings.
Distinct messages have distinct padded block sequences.