RogueInt
Represents an integer value which cannot be discovered or altered using game hacking software. It is slower than int but more secure. It is recommended to use this class instead of the primitive type int for sensitive information.
Android applications are programmed in java, which inherently enables malicious users with reflection-based attacks. The variables used in the application are stored in memory and can be easily read using some tools. What game "hackers" do is to use software to find variables with a specific value among all currently used variables in the application, and modify the values they want to their benefit. As an example, if a hacker wants to have a million coins in your game and they currently have 1200, they look for variables that currently have the value of 1200. If they are lucky, there will be only one variable. If not, they can earn or lose a few coins and track changes in the variables. Finally they find the exact variable that is responsible for the coins and they simply set it to one million in runtime.
The attack described here is a prominent attack and is used by many. The software used for this attack is widely available and does not require any special programming knowledge to operate. For this reason you have to be careful how you keep your sensitive information in the application. Encryption is a good idea for storage. For runtime attacks, this class provides a secure way to store your variables such as scores and coins. The values queried with hacking tools do not reveal the real values stored in this class. This class stores a randomly modified version of the original value to keep it undetected by such software.
public class RogueInt extends Number
Constructor Summary
Modifier and Type | Constructor and Description |
---|---|
public | RogueInt(int initialValue) Creates a RougeInt with the given initial value. |
Method Summary
Modifier and Type | Method and Description |
---|---|
public double | doubleValue() Returns the double representation of the value represented by this RogueInt instance. |
public float | floatValue() Returns the float representation of the value represented by this RogueInt instance. |
public int | intValue() Returns the value represented by this RogueInt instance. |
public long | longValue() Returns the long representation of the value represented by this RogueInt instance. |
public void | set(int intValue) Stores a new value in this RougeInt instance. |
public String | toString() Returns the string representation of the value represented by this RougeInt instance. |
Methods inherited from java.lang.Number
byteValue
, doubleValue
, floatValue
, intValue
, longValue
, shortValue
Methods inherited from java.lang.Object
clone
, equals
, finalize
, getClass
, hashCode
, notify
, notifyAll
, toString
, wait
, wait
, wait
Constructor Detail
RogueInt | ||
---|---|---|
public RogueInt( int initialValue )Creates a RougeInt with the given initial value. Parameters:
|
Method Detail
doubleValue |
---|
public double doubleValue() Returns the double representation of the value represented by this RogueInt instance. Returns:
Stored value converted to double |
floatValue |
---|
public float floatValue() Returns the float representation of the value represented by this RogueInt instance. Returns:
Stored value converted to float |
intValue |
---|
public int intValue() Returns the value represented by this RogueInt instance. Returns:
Stored value |
longValue |
---|
public long longValue() Returns the long representation of the value represented by this RogueInt instance. Returns:
Stored value converted to long |
set | ||
---|---|---|
public void set( int intValue ) Stores a new value in this RougeInt instance. Parameters:
|
toString |
---|
public String toString() Returns the string representation of the value represented by this RougeInt instance. Returns:
String representation of the int value this RogueInt represents |