MCPcopy Create free account
hub / github.com/DNSCrypt/encrypted-dns-server / pad7816

Function pad7816

src/pq.rs:288–295  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
288pub 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)]
298mod tests {

Callers 2

appendix3_vectorsFunction · 0.85
encryptFunction · 0.85

Calls

no outgoing calls

Tested by 1

appendix3_vectorsFunction · 0.68