pub fn pad_remove(data: &[u8]) -> &[u8] {
    let length = data.len();
    let number_of_bytes_added: usize = data[length - 1].into();

    if number_of_bytes_added > (PAD_BASE - 1) || number_of_bytes_added > length {
        return data;
    }

    let pos_of_original_vector = match length.checked_sub(number_of_bytes_added) {
        Some(x) => x,
        None => return data,
    };

    if pos_of_original_vector > 0 && pos_of_original_vector < length {
        &data[0..(pos_of_original_vector)]
    } else {
        data
    }
}
/// removes padding based on padding number
removes padding based on padding number
removes padding based on padding number
pub fn pad_remove(data: &[u8]) -> &[u8] {
    let length = data.len();
    let number_of_bytes_added: usize = data[length - 1].into();
    if number_of_bytes_added > (PAD_BASE - 1) || number_of_bytes_added > length {
        return data;
    }
    let pos_of_original_vector = match length.checked_sub(number_of_bytes_added) {
        Some(x) => x,
        None => return data,
    };
    if pos_of_original_vector > 0 && pos_of_original_vector < length {
        &data[0..(pos_of_original_vector)]
    } else {
        data
    }
}
pub fn pad_remove ( data : & [ u8 ] ) -> & [ u8 ] { let length = data . len ( ) ; let number_of_bytes_added : usize = data [ length - 1 ] . into ( ) ; if number_of_bytes_added > ( PAD_BASE - 1 ) || number_of_bytes_added > length { return data ; } let pos_of_original_vector = match length . checked_sub ( number_of_bytes_added ) { Some ( x ) => x , None => return data , } ; if pos_of_original_vector > 0 && pos_of_original_vector < length { & data [ 0 .. ( pos_of_original_vector ) ] } else { data } }
removes padding based on padding number
removes padding based on padding number
data
&[u8]
data
&[u8]