File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
arex-storage-web-api/src/main/java/com/arextest/storage/utils Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
import java .security .MessageDigest ;
6
6
import java .security .NoSuchAlgorithmException ;
7
- import java .util . Random ;
7
+ import java .security . SecureRandom ;
8
8
9
9
/**
10
10
* @author wildeslam.
13
13
@ Slf4j
14
14
public class RandomUtils {
15
15
private static final int ID_LENGTH = 16 ;
16
- private static final Random RANDOM = new Random ();
16
+ private static final SecureRandom RANDOM = new SecureRandom ();
17
17
18
18
public static String generateRandomId (String identifier ) {
19
19
String sourceString = System .currentTimeMillis () + "-" + RANDOM .nextInt () + "-" + identifier ;
20
20
try {
21
- MessageDigest md = MessageDigest .getInstance ("MD5 " );
21
+ MessageDigest md = MessageDigest .getInstance ("SHA-512 " );
22
22
byte [] bytes = md .digest ((sourceString ).getBytes ());
23
23
StringBuilder sb = new StringBuilder ();
24
24
for (byte b : bytes ) {
You can’t perform that action at this time.
0 commit comments