pad_80

Function pad_80 

Source
pub fn pad_80(
    data: &mut Vec<u8>,
    block_size: usize,
) -> Result<(), Box<dyn Error>>
Expand description

Apply 0x80 padding to a given byte array, in-place.

This function pads the input byte array so that its length is a multiple of the specified block size. The padding starts with a single 0x80 byte followed by 0x00 bytes.

§Arguments

  • data : A mutable reference to the byte array (Vec<u8>) to be padded.
  • block_size : The block size (usize) for padding.

§Returns

  • Ok(()) if the padding is successfully applied.
  • Err(Box<dyn Error>) if the block size is invalid.