zeek/testing/btest/bifs/encode_base64.bro
Jan Grashoefer 8f3ded5e2d Refactoring of Base64 functions.
Base64Converter now uses a connection directly, instead of an analyzer
redirecting to the underlying connection for reporting to Weird. The new
built-in functions en-/decode_base64_intern make use of this to send
encoding-errors to Weird instead of Reporter.

According to the documentation, using the empty string as alphabet in
the built-in functions, will use the default alphabet. Therefore the
built-in functions can now use default arguments and
en-/decode_base64_custom is deprecated.

The tests have been updated accordingly.
2015-08-04 15:46:24 +02:00

19 lines
710 B
Text

# @TEST-EXEC: bro -b %INPUT >out
# @TEST-EXEC: btest-diff out
global default_alphabet: string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
global my_alphabet: string = "!#$%&/(),-.:;<>@[]^ `_{|}~abcdefghijklmnopqrstuvwxyz0123456789+?";
print encode_base64("bro");
print encode_base64("bro", default_alphabet);
print encode_base64("bro", ""); # should use default alpabet
print encode_base64("bro", my_alphabet);
print encode_base64_custom("bro", default_alphabet);
print encode_base64_custom("bro", ""); # should use default alpabet
print encode_base64_custom("bro", my_alphabet);
print encode_base64("padding");
print encode_base64("padding1");
print encode_base64("padding12");