Function decodedLenForSlice [src]
Returns the decoded length of a hexadecimal string, ignoring any characters in the ignore list.
This operation does not run in constant time, but it aims to avoid leaking information about the underlying hexadecimal string.
Prototype
pub fn decodedLenForSlice(decoder: DecoderWithIgnore, encoded: []const u8) !usize Parameters
decoder: DecoderWithIgnoreencoded: []const u8 Source
pub fn decodedLenForSlice(decoder: DecoderWithIgnore, encoded: []const u8) !usize {
var hex_len = encoded.len;
for (encoded) |c| {
if (decoder.ignored_chars.isSet(c)) hex_len -= 1;
}
if (hex_len % 2 != 0) {
return error.InvalidPadding;
}
return hex_len / 2;
}