CRACK RANDOM (JAVA)

zhaozj2021-02-16  76

Java.util.Random generated random number has a certain cycle, improved a version of LCG .. Or SECURITY security point.

Import java.util.random; / ** *

Title: *

description: *

Copyright: Copyright (C) 2001 *

Company : * @Author not attributable * @version 1.0 * /

Public class randomcracker = 0x5deece66dl; protected static final long b = 0xBL; protected static final long m = (1L << 48) -1;

Public static void crack (int xint0, int xint1) {long i; long seed = -1L; long x0 = (xint0 & 0xffffffl) << 16; long x1 = (xint1 & 0xfffffffl); for (i = 0; i <0xffffl; i ) {Seed = ((x0 i) * a) b) & m; if ((SEED >>> 16) == x1) {

Break;} seed = -1L;} if (seed == - 1L) {throw new runtimeException ("INPUT ERROR!");} else {

System.out.println ("THE CRACKED X2 =" ((Seed * A) B & M) >>> 16));

} public static void main (string args []) {random r = new random (); int x0 = r.nextint (); int x1 = r.nextint (); system.out.println ("x0 =" x0 ); System.out.println ("x1 =" x1); CRACK (X0, x1); System.out.Println ("THE REAL X2 =" R.NextINT ());

}

转载请注明原文地址:https://www.9cbs.com/read-22607.html

New Post(0)