summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_basic.erl2
-rw-r--r--src/rabbit_guid.erl5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/rabbit_basic.erl b/src/rabbit_basic.erl
index 85a18c7185..55bbdf3a77 100644
--- a/src/rabbit_basic.erl
+++ b/src/rabbit_basic.erl
@@ -139,7 +139,7 @@ message(XName, RoutingKey, #content{properties = Props} = DecodedContent) ->
{ok, #basic_message{
exchange_name = XName,
content = strip_header(DecodedContent, ?DELETED_HEADER),
- id = rabbit_guid:gen(),
+ id = rabbit_guid:gen_secure(),
is_persistent = is_message_persistent(DecodedContent),
routing_keys = [RoutingKey |
header_routes(Props#'P_basic'.headers)]}}
diff --git a/src/rabbit_guid.erl b/src/rabbit_guid.erl
index 4fe6eaee45..5751d660a3 100644
--- a/src/rabbit_guid.erl
+++ b/src/rabbit_guid.erl
@@ -90,8 +90,9 @@ blocks_to_binary({B1, B2, B3, B4}) ->
%% generate a GUID. This function should be used when performance is a
%% priority and predictability is not an issue. Otherwise, use gen_secure/0.
gen() ->
- %% We hash a fresh GUID and then XOR it with a process-local counter
- %% to get a new GUID each time.
+ %% We hash a fresh GUID with md5, split it in 5 blocks, and each time we
+ %% need a new guid we hash the first block and the counter and xor the
+ %% result with the remaining blocks.
{BS, I} =
case get(guid) of
undefined ->