big-list-of-naughty-strings
big-list-of-naughty-strings copied to clipboard
Newlines characters in base64
All base64 strings¹ end with a newline character, eg.:
>>> base64.b64decode("dW5kZWZpbmVkCg==")
b'undefined\n'
>>> base64.b64decode("dW5kZWYK")
b'undef\n'
>>> base64.b64decode("Q09NMQo=")
b'COM1\n'
Is this on purpose? That newline character seems pretty useless.
If not, that line should probably read echo -n.
1: all but the empty string itself, which makes it even more annoying because it makes two cases to handle.
The newline character is added by the python decode method. This is not a problem with the base64 itself
base64.b64decode('Q09NMQo=').rstrip('\n')
@romuald: No, it isn’t.
$ printf 'COM1\n' | base64
Q09NMQo=
$ printf 'COM1' | base64
Q09NMQ==
Oops, sorry. You're right, confounded the decode and encode behaviors …