MCPcopy Create free account
hub / github.com/RustCrypto/utils / unpad_blocks

Method unpad_blocks

block-padding/src/lib.rs:135–143  ·  view source on GitHub ↗
(blocks: &[Array<u8, BlockSize>])

Source from the content-addressed store, hash-verified

133
134 #[inline]
135 fn unpad_blocks<BlockSize: ArraySize>(blocks: &[Array<u8, BlockSize>]) -> Result<&[u8], Error> {
136 let buf = Array::slice_as_flattened(blocks);
137 for i in (0..buf.len()).rev() {
138 if buf[i] != 0 {
139 return Ok(&buf[..i + 1]);
140 }
141 }
142 Ok(&buf[..0])
143 }
144}
145
146/// Pad block with bytes with value equal to the number of bytes added.

Callers

nothing calls this directly

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected