mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-19 07:02:51 +08:00
Replacing Math.random() with something a little more random.
This commit is contained in:
parent
9f41906895
commit
b37498d5f6
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
|
||||||
import org.apache.cordova.PluginManager;
|
import org.apache.cordova.PluginManager;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@ -107,7 +109,8 @@ public class CordovaBridge {
|
|||||||
|
|
||||||
/** Called by cordova.js to initialize the bridge. */
|
/** Called by cordova.js to initialize the bridge. */
|
||||||
int generateBridgeSecret() {
|
int generateBridgeSecret() {
|
||||||
expectedBridgeSecret = (int)(Math.random() * Integer.MAX_VALUE);
|
SecureRandom randGen = new SecureRandom();
|
||||||
|
expectedBridgeSecret = (int)(randGen.nextInt() * Integer.MAX_VALUE);
|
||||||
return expectedBridgeSecret;
|
return expectedBridgeSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user