CyberChef
CyberChef copied to clipboard
Fix OperationError when strict mode is enabled and text is not padded
When Base64 input is not padded and strict mode is enabled, CyberChef rejects the input with the error "Error: Base64 input contains non-alphabet char(s)". This is because enc3
and enc4
might be -1 because the text doesn't have chars at the third and fourth locations
Hey @pandaninjas, it feels like when enabling strict mode
I'd expect things to fail if the Base64 isn't padded correctly. Is there a reason you think it shouldn't? The default behaviour does pass Base64 without proper padding correctly.
Hey @pandaninjas, it feels like when enabling
strict mode
I'd expect things to fail if the Base64 isn't padded correctly. Is there a reason you think it shouldn't? The default behaviour does pass Base64 without proper padding correctly.
It's not that it isn't padded correctly. If a Base64 alphabet does not have a padding character (i.e. the alphabet is 64 characters only), then decoding will always fail when padding is missing. See screenshot:
Though now that I think about it there's probably a better way to do it.