ISO/IEC 7816-4 padding to the next multiple of 64, with a minimum floor (itself a multiple of 64). Always appends at least the `0x80` marker.
(plaintext: &mut Vec<u8>, floor: usize)
| 286 | /// ISO/IEC 7816-4 padding to the next multiple of 64, with a minimum floor |
| 287 | /// (itself a multiple of 64). Always appends at least the `0x80` marker. |
| 288 | pub fn pad7816(plaintext: &mut Vec<u8>, floor: usize) { |
| 289 | plaintext.push(0x80); |
| 290 | let mut target = (plaintext.len() + 63) & !63; |
| 291 | if target < floor { |
| 292 | target = floor; |
| 293 | } |
| 294 | plaintext.resize(target, 0); |
| 295 | } |
| 296 | |
| 297 | #[cfg(test)] |
| 298 | mod tests { |
no outgoing calls