Skip to content

Commit b188e0f

Browse files
author
tom zhou
committed
use java secure random
1 parent 88b48aa commit b188e0f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/com/iwebpp/crypto/TweetNacl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package com.iwebpp.crypto;
55

66
import java.io.UnsupportedEncodingException;
7-
import java.util.Random;
7+
import java.security.SecureRandom;
88
import java.util.concurrent.atomic.AtomicLong;
99

1010

@@ -1881,9 +1881,9 @@ public static int crypto_sign_open(byte [] m, long dummy /* *mlen not used*/, by
18811881

18821882
/*
18831883
* @description
1884-
* Java Random generator
1884+
* Java SecureRandom generator
18851885
* */
1886-
private static final Random jrandom = new Random();
1886+
private static final SecureRandom jrandom = new SecureRandom();
18871887

18881888
private static void randombytes(byte [] x, int len) {
18891889
int ret = len % 8;

src/com/iwebpp/crypto/TweetNaclFast.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package com.iwebpp.crypto;
55

66
import java.io.UnsupportedEncodingException;
7-
import java.util.Random;
7+
import java.security.SecureRandom;
88
import java.util.concurrent.atomic.AtomicLong;
99

1010

@@ -3205,9 +3205,9 @@ public static int crypto_sign_open(byte [] m, long dummy /* *mlen not used*/, by
32053205

32063206
/*
32073207
* @description
3208-
* Java Random generator
3208+
* Java SecureRandom generator
32093209
* */
3210-
private static final Random jrandom = new Random();
3210+
private static final SecureRandom jrandom = new SecureRandom();
32113211

32123212
private static void randombytes(byte [] x, int len) {
32133213
int ret = len % 8;

0 commit comments

Comments
 (0)