Function aes_frast::padding_128bit::pa_zeros
[−]
[src]
pub fn pa_zeros(input_vec: &mut Vec<u8>)
Zeros padding
This padding has never been standardized in cryptography specifications. So, NOT recommended.
This padding here maybe differ from it in other implements, because this function still adds a
complete block after the complete end-block, while maybe some other implements don't and only add
to the incomplete end-block. If you are looking for function like that, see pa_zeros_ifnotcomplete
.
[Attention!] If the origin data ends with zero(s) (one or more 0xFF), depadding will remove all these zeros.
Examples
use aes_frast::padding_128bit::pa_zeros; let mut origin = vec![0xFFu8; 7]; pa_zeros(&mut origin); assert_eq!(origin, vec![0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8]); origin = vec![0xFFu8; 16]; pa_zeros(&mut origin); assert_eq!(origin, vec![0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0xFFu8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8, 0x00u8]);