rayferric / regen

🌌 LCG-RNG reverser for the Java programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Regen

🌌 LCG-RNG reverser for the Java programming language. The library is able to reverse-engineer the internal state of any linear congruential pseudo-random number generator. Works by finding integer solutions to a system of linear inequalities on consecutive random calls.

Features

  • πŸ”₯ Simple and Convenient API
  • πŸ’» Multithreading Support
  • πŸ“ Rich Linear Algebra Library
  • πŸ’¨ Uncompromised Performance

Getting Started

Prerequisites

Gradle

repositories {
    maven {
        url 'https://jitpack.io'
    }
}

dependencies {
    implementation 'com.github.rayferric:regen:1.0.1'
}

Example

Random random = new Random(314159265359L);
RandomReverser reverser = new RandomReverser();

for(int i = 0; i < 30; i++) {
	int value = random.nextInt(256);
	int min = Math.max(value - 16, 0);
	int max = Math.min(value + 16, 255);
	RandomCall call = new JavaIntegerRangeCall(256, min, max);

	// For optimal performance, further calls should be registered in filter-only mode:
	if(i < 15)
		reverser.addCall(call);
	else
		reverser.addFilter(call);

	// Unmeasured calls can be skipped:
	random.nextBoolean();
	reverser.skip(JavaBooleanCall.SKIPS);
}

// The default Java RNG automatically scrambles the seed using XOR:
reverser.solve(LCG.JAVA).map(LCG.JAVA::scramble).forEach(System.out::println);

About

Authors

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

🌌 LCG-RNG reverser for the Java programming language.

License:MIT License


Languages

Language:Java 100.0%