Inherits IFormattable, IEquatable< ObscuredShort >, IEquatable< short >, IComparable< ObscuredShort >, IComparable< short >, IComparable, and IObscuredType.
Use it instead of regular short
for any cheating-sensitive variables.
Regular type is faster and memory wiser comparing to the obscured one!
Feel free to use regular types for all short-term operations and calculations while keeping obscured type only at the long-term declaration (i.e. class field).
◆ Encrypt()
static short Encrypt |
( |
short |
value, |
|
|
short |
key |
|
) |
| |
|
inlinestatic |
◆ Decrypt()
static short Decrypt |
( |
short |
value, |
|
|
short |
key |
|
) |
| |
|
inlinestatic |
◆ FromEncrypted()
static ObscuredShort FromEncrypted |
( |
short |
encrypted, |
|
|
short |
key |
|
) |
| |
|
inlinestatic |
Creates and fills obscured variable with raw encrypted value previously got from GetEncrypted().
Literally does same job as SetEncrypted() but makes new instance instead of filling existing one, making it easier to initialize new variables from saved encrypted values.
- Parameters
-
- Returns
- New obscured variable initialized from specified encrypted value.
- See also
- GetEncrypted(), SetEncrypted()
◆ GenerateKey()
static short GenerateKey |
( |
| ) |
|
|
inlinestatic |
Generates random key. Used internally and can be used to generate key for manual Encrypt() calls.
- Returns
- Key suitable for manual Encrypt() calls.
◆ GetEncrypted()
short GetEncrypted |
( |
out short |
key | ) |
|
|
inline |
Allows to pick current obscured value as is.
- Parameters
-
key | Encryption key needed to decrypt returned value. |
- Returns
- Encrypted value as is.
Use it in conjunction with SetEncrypted().
Useful for saving data in obscured state.
- See also
- FromEncrypted(), SetEncrypted()
◆ SetEncrypted()
void SetEncrypted |
( |
short |
encrypted, |
|
|
short |
key |
|
) |
| |
|
inline |
Allows to explicitly set current obscured value. Crypto key should be same as when encrypted value was got with GetEncrypted().
Use it in conjunction with GetEncrypted().
Useful for loading data stored in obscured state.
- See also
- FromEncrypted()
◆ GetDecrypted()
Alternative to the type cast, use if you wish to get decrypted value but can't or don't want to use cast to the regular type.
- Returns
- Decrypted value.
◆ RandomizeCryptoKey()
void RandomizeCryptoKey |
( |
| ) |
|
|
inline |
Allows to change current crypto key to the new random value and re-encrypt variable using it. Use it for extra protection against 'unknown value' search. Just call it sometimes when your variable doesn't change to fool the cheater.
Implements IObscuredType.