Skip to content

Commit

Permalink
Merge pull request #4415 from esl/base16
Browse files Browse the repository at this point in the history
Get rid of base16
  • Loading branch information
telezynski authored Dec 17, 2024
2 parents 5b10044 + 2deccca commit f813f94
Show file tree
Hide file tree
Showing 35 changed files with 67 additions and 70 deletions.
1 change: 0 additions & 1 deletion big_tests/rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

%% We use https:// instead of git://
{deps, [
{base16, "2.0.1"},
{exml, "3.4.1", {pkg, hexml}},
{bbmustache, "1.12.2"},
{jiffy, "1.1.2"},
Expand Down
2 changes: 1 addition & 1 deletion big_tests/rebar.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{"1.2.0",
[{<<"amqp_client">>,{pkg,<<"amqp_client">>,<<"4.0.3">>},0},
{<<"base16">>,{pkg,<<"base16">>,<<"2.0.1">>},0},
{<<"base16">>,{pkg,<<"base16">>,<<"2.0.1">>},1},
{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.12.2">>},0},
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.12.0">>},0},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.13.0">>},1},
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/component_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ component_handshake(Conn = #client{props = Props}, []) ->
component_handshake_el(SID, Password) ->
Handshake = crypto:hash(sha, <<SID/binary, Password/binary>>),
#xmlel{name = <<"handshake">>,
children = [#xmlcdata{content = base16:encode(Handshake)}]}.
children = [#xmlcdata{content = binary:encode_hex(Handshake, lowercase)}]}.

component_start_stream_subdomain(Conn = #client{props = Props}, []) ->
{component, Component} = lists:keyfind(component, 1, Props),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/graphql_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ init_domain_admin_handler(Config) ->
init_domain_admin_handler(Config, Domain) ->
case mongoose_helper:is_rdbms_enabled(Domain) of
true ->
Password = base16:encode(crypto:strong_rand_bytes(8)),
Password = binary:encode_hex(crypto:strong_rand_bytes(8)),
Creds = {<<"admin@", Domain/binary>>, Password},
domain_helper:set_domain_password(mim(), Domain, Password),
add_specs([{protocol, http}, {domain_admin, Creds}, {schema_endpoint, domain_admin}
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/graphql_stanza_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ user_send_stanza_without_from_with_id(Config) ->

user_send_stanza_without_from_with_id_story(Config, Alice, Bob) ->
Body = <<"Hi!">>,
StanzaId = base16:encode(crypto:strong_rand_bytes(8)),
StanzaId = binary:encode_hex(crypto:strong_rand_bytes(8)),
Stanza = escalus_stanza:set_id(escalus_stanza:chat_to_short_jid(Bob, Body), StanzaId),
Res = user_send_stanza(Alice, exml:to_binary(Stanza), Config),
?assertEqual(#{<<"id">> => StanzaId}, get_ok_value([data, stanza, sendStanza], Res)),
Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/inbox_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ check_result(Packet, ExpectedResult) ->
ExpectedResult).

maybe_make_queryid(iq_id) ->
#{iq_id => base16:encode(crypto:strong_rand_bytes(16))};
#{iq_id => binary:encode_hex(crypto:strong_rand_bytes(16), lowercase)};
maybe_make_queryid(queryid) ->
#{queryid => base16:encode(crypto:strong_rand_bytes(16))};
#{queryid => binary:encode_hex(crypto:strong_rand_bytes(16), lowercase)};
maybe_make_queryid(undefined) ->
#{}.

Expand Down
14 changes: 7 additions & 7 deletions big_tests/tests/jingle_sip_translator.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ make_200_ok_for_conference_call(Socket, Tr, #sip{hdrs = Hdrs} = Sip, #sip{hdrs =
make_200_ok_for_phone_call(Tr, Sip, Resp183),
{_, #uri{user = ReceiverUser}, _Params} = Receiver = esip:get_hdr(to, RespHdrs),
{_, _, _} = Initiator = esip:get_hdr(from, RespHdrs),
Branch = base16:encode(crypto:strong_rand_bytes(3)),
Branch = binary:encode_hex(crypto:strong_rand_bytes(3), lowercase),
URIBin = <<"sip:",ReceiverUser/binary,"@127.0.0.1:12345;ob;transport=tcp">>,
ContactURI = esip_codec:decode_uri(URIBin),
Contact = {<<>>, ContactURI, []},
Expand All @@ -142,7 +142,7 @@ make_200_ok_for_conference_call(Socket, Tr, #sip{hdrs = Hdrs} = Sip, #sip{hdrs =

make_forward_req(#sip{hdrs = Hdrs} = Sip) ->
%% Forward the request back to MongooseIM
Branch = base16:encode(crypto:strong_rand_bytes(3)),
Branch = binary:encode_hex(crypto:strong_rand_bytes(3), lowercase),
{_, #uri{user = FromUser}, _} = esip:get_hdr(to, Hdrs),
URIBin = <<"sip:",FromUser/binary,"@127.0.0.1:12345;ob;transport=tcp">>,
ContactURI = esip_codec:decode_uri(URIBin),
Expand Down Expand Up @@ -246,7 +246,7 @@ dialog_callback(#sip{type = request, hdrs = Hdrs} = Req, Socket, _Tr) ->
{_, #uri{user = ToUser}, _} = To,
{_, #uri{user = _FromUser}, _} = From,

Branch = base16:encode(crypto:strong_rand_bytes(3)),
Branch = binary:encode_hex(crypto:strong_rand_bytes(3), lowercase),
URIBin = <<"sip:",ToUser/binary,"@127.0.0.1:12345;ob;transport=tcp">>,
ContactURI = esip_codec:decode_uri(URIBin),
Contact = {<<>>, ContactURI, []},
Expand Down Expand Up @@ -277,15 +277,15 @@ send_invite(From, To, Pid) ->

FromURI = esip_codec:decode_uri(<<"sip:", FromJID/binary>>),
FromSIP = {FromUser, FromURI,
[{<<"tag">>, base16:encode(crypto:strong_rand_bytes(2))}]},
[{<<"tag">>, binary:encode_hex(crypto:strong_rand_bytes(2), lowercase)}]},

ToUser = escalus_client:username(To),
ToJID = escalus_client:short_jid(To),
ToURI = esip_codec:decode_uri(<<"sip:", ToJID/binary>>),
ToSIP = {ToUser, ToURI, []},
CallID = base16:encode(crypto:strong_rand_bytes(6)),
CallID = binary:encode_hex(crypto:strong_rand_bytes(6), lowercase),
CSeq = 141501489,
Branch = base16:encode(crypto:strong_rand_bytes(3)),
Branch = binary:encode_hex(crypto:strong_rand_bytes(3), lowercase),
ContactURI = esip_codec:decode_uri(<<"sip:",FromUser/binary,"@127.0.0.1:12345;ob">>),
Contact = {<<>>, ContactURI, []},

Expand Down Expand Up @@ -322,7 +322,7 @@ send_ack_for_200_ok(#sip{type = response, method = <<"INVITE">>,
'route', 'max-forwards',
'authorization', 'to', 'from',
'proxy-authorization'], Hdrs),
Branch = base16:encode(crypto:strong_rand_bytes(3)),
Branch = binary:encode_hex(crypto:strong_rand_bytes(3), lowercase),
Via = #via{transport = <<"UDP">>, host = <<"127.0.0.1">>, port = 12345,
params = [{<<"rport">>, <<>>},
{<<"branch">>, <<"z9hG4bK-", Branch/binary>>}]},
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/mam_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ generate_msg_for_date_user(Owner, Remote, DateTime) ->
generate_msg_for_date_user(Owner, Remote, DateTime, random_text()).

random_text() ->
base16:encode(crypto:strong_rand_bytes(4)).
binary:encode_hex(crypto:strong_rand_bytes(4)).

generate_msg_for_date_user(Owner, {RemoteBin, _, _} = Remote, DateTime, Content) ->
Microsec = datetime_to_microseconds(DateTime),
Expand Down
4 changes: 2 additions & 2 deletions big_tests/tests/mim_c2s_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ two_users_can_log_and_chat(Config) ->
too_big_stanza_is_rejected(Config) ->
AliceSpec = escalus_fresh:create_fresh_user(Config, alice),
{ok, Alice, _Features} = escalus_connection:start(AliceSpec),
BigBody = base16:encode(crypto:strong_rand_bytes(?MAX_STANZA_SIZE)),
BigBody = binary:encode_hex(crypto:strong_rand_bytes(?MAX_STANZA_SIZE)),
escalus_client:send(Alice, escalus_stanza:chat_to(Alice, BigBody)),
escalus:assert(is_stream_error, [<<"policy-violation">>, <<>>], escalus_client:wait_for_stanza(Alice)),
escalus:assert(is_stream_end, escalus_client:wait_for_stanza(Alice)),
Expand All @@ -141,7 +141,7 @@ too_big_stanza_is_rejected(Config) ->
too_big_opening_tag_is_rejected(Config) ->
AliceSpec = escalus_fresh:create_fresh_user(Config, alice),
{ok, Alice, _Features} = escalus_connection:start(AliceSpec, []),
BigAttrs = [{<<"bigattr">>, base16:encode(crypto:strong_rand_bytes(?MAX_STANZA_SIZE))}],
BigAttrs = [{<<"bigattr">>, binary:encode_hex(crypto:strong_rand_bytes(?MAX_STANZA_SIZE))}],
escalus_client:send(Alice, #xmlel{name = <<"stream:stream">>, attrs = BigAttrs}),
escalus:assert(is_stream_start, escalus_client:wait_for_stanza(Alice)),
escalus:assert(is_stream_error, [<<"xml-not-well-formed">>, <<>>],
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/muc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -5419,4 +5419,4 @@ fresh_nick_name(Prefix) ->
<<Prefix/binary, (fresh_nick_name())/binary>>.

fresh_nick_name() ->
fresh_room_name(base16:encode(crypto:strong_rand_bytes(5))).
fresh_room_name(binary:encode_hex(crypto:strong_rand_bytes(5), lowercase)).
2 changes: 1 addition & 1 deletion big_tests/tests/muc_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ fresh_room_name(Username) ->
escalus_utils:jid_to_lower(<<"room-", Username/binary>>).

fresh_room_name() ->
fresh_room_name(base16:encode(crypto:strong_rand_bytes(5))).
fresh_room_name(binary:encode_hex(crypto:strong_rand_bytes(5), lowercase)).

stanza_get_features() ->
%% <iq from='[email protected]/pda'
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/muc_light_http_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ create_identifiable_room(Config) ->
escalus:fresh_story(Config, [{alice, 1}], fun(Alice) ->
MUCLightDomain = muc_light_domain(),
Path = path([MUCLightDomain]),
RandBits = base16:encode(crypto:strong_rand_bytes(5)),
RandBits = binary:encode_hex(crypto:strong_rand_bytes(5), lowercase),
Name = <<"wonderland">>,
RoomID = <<"just_some_id_", RandBits/binary>>,
RoomIDescaped = escalus_utils:jid_to_lower(RoomID),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/push_integration_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ fresh_room_name(Username) ->
escalus_utils:jid_to_lower(<<"room-", Username/binary>>).

fresh_room_name() ->
fresh_room_name(base16:encode(crypto:strong_rand_bytes(5))).
fresh_room_name(binary:encode_hex(crypto:strong_rand_bytes(5), lowercase)).


bare_jid(JIDOrClient) ->
Expand Down
32 changes: 16 additions & 16 deletions big_tests/tests/rest_client_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ user_can_be_added_and_removed_by_room_jid(Config) ->
msg_with_props_is_sent_and_delivered_over_xmpp(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) ->
BobJID = user_jid(Bob),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_props(BobJID,MsgID),

escalus:send(Alice, M1),
Expand All @@ -728,7 +728,7 @@ msg_with_props_can_be_parsed(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) ->
AliceJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Alice)),
BobJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Bob)),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_props(BobJID,MsgID),

escalus:send(Alice, M1),
Expand Down Expand Up @@ -759,7 +759,7 @@ msg_with_props_can_be_parsed(Config) ->
msg_with_malformed_props_is_sent_and_delivered_over_xmpp(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun(Alice, Bob) ->
BobJID = user_jid(Bob),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),

M1 = rest_helper:make_malformed_msg_stanza_with_props(BobJID, MsgID),

Expand All @@ -774,7 +774,7 @@ msg_with_malformed_props_can_be_parsed(Config) ->
AliceJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Alice)),
AliceCreds = {AliceJID, user_password(alice)},
BobJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Bob)),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),

M1 = rest_helper:make_malformed_msg_stanza_with_props(BobJID,MsgID),
escalus:send(Alice, M1),
Expand All @@ -794,8 +794,8 @@ msg_with_malformed_props_can_be_parsed(Config) ->
msg_with_thread_is_sent_and_delivered_over_xmpp(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun (Alice, Bob) ->
BobJID = user_jid(Bob),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_thread(BobJID, MsgID, ThreadID),
escalus:send(Alice, M1),
M2 = escalus:wait_for_stanza(Bob),
Expand All @@ -806,8 +806,8 @@ msg_with_thread_can_be_parsed(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun (Alice, Bob) ->
AliceJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Alice)),
BobJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Bob)),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_thread(BobJID, MsgID, ThreadID),
escalus:send(Alice, M1),
escalus:wait_for_stanza(Bob),
Expand All @@ -829,9 +829,9 @@ msg_with_thread_can_be_parsed(Config) ->
msg_with_thread_and_parent_is_sent_and_delivered_over_xmpp(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun (Alice, Bob) ->
BobJID = user_jid(Bob),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadParentID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadParentID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_thread_and_parent(BobJID, MsgID, ThreadID, ThreadParentID),
escalus:send(Alice, M1),
M2 = escalus:wait_for_stanza(Bob),
Expand All @@ -842,9 +842,9 @@ msg_with_thread_and_parent_can_be_parsed(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun (Alice, Bob) ->
AliceJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Alice)),
BobJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Bob)),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadID = base16:encode(crypto:strong_rand_bytes(5)),
ThreadParentID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadID = binary:encode_hex(crypto:strong_rand_bytes(5)),
ThreadParentID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_with_thread_and_parent(BobJID, MsgID, ThreadID, ThreadParentID),
escalus:send(Alice, M1),
escalus:wait_for_stanza(Bob),
Expand All @@ -868,7 +868,7 @@ msg_with_thread_and_parent_can_be_parsed(Config) ->
msg_without_thread_is_sent_and_delivered_over_xmpp(Config) ->
escalus:fresh_story(Config, [{alice, 1}, {bob, 1}], fun (Alice, Bob) ->
BobJID = user_jid(Bob),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_without_thread(BobJID, MsgID),
escalus:send(Alice, M1),
M2 = escalus:wait_for_stanza(Bob),
Expand All @@ -880,7 +880,7 @@ msg_without_thread_can_be_parsed(Config) ->
AliceJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Alice)),
AliceCreds = {AliceJID, user_password(alice)},
BobJID = escalus_utils:jid_to_lower(escalus_client:short_jid(Bob)),
MsgID = base16:encode(crypto:strong_rand_bytes(5)),
MsgID = binary:encode_hex(crypto:strong_rand_bytes(5)),
M1 = rest_helper:make_msg_stanza_without_thread(BobJID, MsgID),
escalus:send(Alice, M1),
escalus:wait_for_stanza(Bob),
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/rest_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fusco_request(Method, Path, Body, HeadersIn, Port, SSL, Params) ->
Result.

random_request_id() ->
base16:encode(crypto:strong_rand_bytes(8)).
binary:encode_hex(crypto:strong_rand_bytes(8)).

report_errors(Client, Path, Method, Headers, Body,
{{CodeBin, _}, _RHeaders, _RBody, _, _} = Result,
Expand Down
2 changes: 1 addition & 1 deletion big_tests/tests/websockets_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ too_big_stanza_is_rejected(Config) ->
escalus:story(
Config, [{alice, 1}, {?config(user, Config), 1}],
fun(Alice, Geralt) ->
BigBody = base16:encode(crypto:strong_rand_bytes(?MAX_STANZA_SIZE)),
BigBody = binary:encode_hex(crypto:strong_rand_bytes(?MAX_STANZA_SIZE)),
escalus_client:send(Geralt, escalus_stanza:chat_to(Alice, BigBody)),
escalus:assert(is_stream_error, [<<"policy-violation">>, <<>>], escalus_client:wait_for_stanza(Geralt)),
escalus:assert(is_stream_end, escalus_client:wait_for_stanza(Geralt)),
Expand Down
1 change: 0 additions & 1 deletion rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
{deps,
[
%%% Stateless parsers
{base16, "2.0.1"},
{exml, "3.4.1", {pkg, hexml}},
{jiffy, "1.1.2"},
{jid, "2.2.0", {pkg, mongoose_jid}},
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[{<<"accept">>,{pkg,<<"accept">>,<<"0.3.5">>},2},
{<<"amqp_client">>,{pkg,<<"amqp_client">>,<<"4.0.3">>},0},
{<<"backoff">>,{pkg,<<"backoff">>,<<"1.1.6">>},1},
{<<"base16">>,{pkg,<<"base16">>,<<"2.0.1">>},0},
{<<"base16">>,{pkg,<<"base16">>,<<"1.0.0">>},1},
{<<"bbmustache">>,{pkg,<<"bbmustache">>,<<"1.12.2">>},0},
{<<"bear">>,{pkg,<<"bear">>,<<"1.0.0">>},1},
{<<"cache_tab">>,{pkg,<<"cache_tab">>,<<"1.0.31">>},0},
Expand Down Expand Up @@ -124,7 +124,7 @@
{<<"accept">>, <<"B33B127ABCA7CC948BBE6CAA4C263369ABF1347CFA9D8E699C6D214660F10CD1">>},
{<<"amqp_client">>, <<"C7DCC8031C780CD39EC586BA827A8EB26E006E9761AF8D3F58FDED11F645EBD4">>},
{<<"backoff">>, <<"83B72ED2108BA1EE8F7D1C22E0B4A00CFE3593A67DBC792799E8CCE9F42F796B">>},
{<<"base16">>, <<"F0549F732E03BE8124ED0D19FD5EE52146CC8BE24C48CBC3F23AB44B157F11A2">>},
{<<"base16">>, <<"283644E2B21BD5915ACB7178BED7851FB07C6E5749B8FAD68A53C501092176D9">>},
{<<"bbmustache">>, <<"0CABDCE0DB9FE6D3318131174B9F2B351328A4C0AFBEB3E6E99BB0E02E9B621D">>},
{<<"bear">>, <<"430419C1126B477686CDE843E88BA0F2C7DC5CDF0881C677500074F704339A99">>},
{<<"cache_tab">>, <<"E4097B50A6F373AB1E0A5F01BAB0BEF6626771A4CD6C93404ED6D54810E11FBC">>},
Expand Down Expand Up @@ -195,7 +195,7 @@
{<<"accept">>, <<"11B18C220BCC2EAB63B5470C038EF10EB6783BCB1FCDB11AA4137DEFA5AC1BB8">>},
{<<"amqp_client">>, <<"AE945F7280617E9A4B17A6D49E3A2F496D716E8088EC29D8E94ECC79E5DA7458">>},
{<<"backoff">>, <<"CF0CFFF8995FB20562F822E5CC47D8CCF664C5ECDC26A684CBE85C225F9D7C39">>},
{<<"base16">>, <<"06EA2D48343282E712160BA89F692B471DB8B36ABE8394F3445FF9032251D772">>},
{<<"base16">>, <<"02AFD0827E61A7B07093873E063575CA3A2B07520567C7F8CEC7C5D42F052D76">>},
{<<"bbmustache">>, <<"688B33A4D5CC2D51F575ADF0B3683FC40A38314A2F150906EDCFC77F5B577B3B">>},
{<<"bear">>, <<"157B67901ADF84FF0DA6EAE035CA1292A0AC18AA55148154D8C582B2C68959DB">>},
{<<"cache_tab">>, <<"8582B60A4A09B247EF86355BA9E07FCE9E11EDC0345A775C9171F971C72B6351">>},
Expand Down
2 changes: 1 addition & 1 deletion src/http_upload/aws_signature_v4.erl
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ uri_encode_char(C, _) -> list_to_binary([$% | integer_to_list(C, 16)]).

-spec hex(Data :: binary()) -> HexEncoded :: binary().
hex(Data) ->
base16:encode(Data).
binary:encode_hex(Data, lowercase).


-spec sha256_hash(Data :: binary()) -> Hash :: binary().
Expand Down
2 changes: 1 addition & 1 deletion src/http_upload/mod_http_upload.erl
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ module_opts(HostType) ->

-spec generate_token(mongooseim:host_type()) -> binary().
generate_token(HostType) ->
base16:encode(crypto:strong_rand_bytes(token_bytes(HostType))).
binary:encode_hex(crypto:strong_rand_bytes(token_bytes(HostType)), lowercase).


-spec file_too_large_error(MaxFileSize :: non_neg_integer()) -> exml:element().
Expand Down
2 changes: 1 addition & 1 deletion src/jingle_sip/sip_to_jingle.erl
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ parse_nksip_media_attr(<<"candidate">>, Params, Acc) ->
ip => IP,
port => Port,
network => <<"0">>, %% no SDP equivalent
id => base16:encode(crypto:strong_rand_bytes(5))},
id => binary:encode_hex(crypto:strong_rand_bytes(5), lowercase)},
CompleteCandidate = parse_candidate_extra_args(ExtraArgs, Candidate),
Transport = maps:get(transport, Acc, #{}),
Candidates = maps:get(candidates, Transport, []),
Expand Down
Loading

0 comments on commit f813f94

Please sign in to comment.