You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jm...@apache.org on 2016/05/05 22:09:14 UTC
[3/6] cassandra git commit: CASSANDRA-11518,
use SecureRandom instead of java.util.Random to initialize UUIDGen
clock sequence.
CASSANDRA-11518, use SecureRandom instead of java.util.Random to initialize UUIDGen clock sequence.
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/c19066ee
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/c19066ee
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/c19066ee
Branch: refs/heads/trunk
Commit: c19066ee0251fc9d3d7d8217949b93a65088a8e9
Parents: b8f2011
Author: Ariel Weisberg <ar...@datastax.com>
Authored: Wed Apr 6 17:05:39 2016 -0400
Committer: Josh McKenzie <jo...@datastax.com>
Committed: Thu May 5 18:08:27 2016 -0400
----------------------------------------------------------------------
src/java/org/apache/cassandra/utils/UUIDGen.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/c19066ee/src/java/org/apache/cassandra/utils/UUIDGen.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/utils/UUIDGen.java b/src/java/org/apache/cassandra/utils/UUIDGen.java
index df07e1f..f50545b 100644
--- a/src/java/org/apache/cassandra/utils/UUIDGen.java
+++ b/src/java/org/apache/cassandra/utils/UUIDGen.java
@@ -21,6 +21,7 @@ import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
import java.util.Collection;
import java.util.Random;
import java.util.UUID;
@@ -239,7 +240,7 @@ public class UUIDGen
private static long makeClockSeqAndNode()
{
- long clock = new Random(System.currentTimeMillis()).nextLong();
+ long clock = new SecureRandom().nextLong();
long lsb = 0;
lsb |= 0x8000000000000000L; // variant (2 bits)