mirror of
https://github.com/zeek/zeek.git
synced 2025-10-07 00:58:19 +00:00
and add bae64 bif tests.
This commit is contained in:
parent
a1896fde90
commit
a5161783ef
3 changed files with 21 additions and 1 deletions
|
@ -261,7 +261,7 @@ BroString* encode_base64(const BroString* s, const BroString* a)
|
|||
|
||||
char* outbuf = 0;
|
||||
int outlen = 0;
|
||||
Base64Decoder enc(0);
|
||||
Base64Decoder enc(0, a ? a->CheckString() : "");
|
||||
enc.Encode(s->Len(), (const unsigned char*) s->Bytes(), &outlen, &outbuf);
|
||||
|
||||
return new BroString(1, (u_char*)outbuf, outlen);
|
||||
|
|
6
testing/btest/Baseline/bifs.encode_base64/out
Normal file
6
testing/btest/Baseline/bifs.encode_base64/out
Normal file
|
@ -0,0 +1,6 @@
|
|||
YnJv
|
||||
YnJv
|
||||
}n-v
|
||||
cGFkZGluZw==
|
||||
cGFkZGluZzE=
|
||||
cGFkZGluZzEy
|
14
testing/btest/bifs/encode_base64.bro
Normal file
14
testing/btest/bifs/encode_base64.bro
Normal file
|
@ -0,0 +1,14 @@
|
|||
# @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_custom("bro", default_alphabet);
|
||||
print encode_base64_custom("bro", my_alphabet);
|
||||
|
||||
print encode_base64("padding");
|
||||
print encode_base64("padding1");
|
||||
print encode_base64("padding12");
|
Loading…
Add table
Add a link
Reference in a new issue