pub fn decode(bin: []u8, encoded: []const u8) error bin: []u8encoded: []const u841
42
43
44
45
46
47
48
49
50
51
52
53
54 pub fn decode(bin: []u8, encoded: []const u8) error{ SizeMismatch, InvalidCharacter, InvalidPadding }!void {
if (encoded.len % 2 != 0) {
return error.InvalidPadding;
}
if (bin.len < encoded.len / 2) {
return error.SizeMismatch;
}
_ = decodeAny(bin, encoded, null) catch |err| {
switch (err) {
error.InvalidCharacter, error.InvalidPadding => |e| return e,
else => unreachable,
}
};
}
Decodes a hexadecimal string into a binary buffer. The output buffer must be half the size of the input buffer.