My Project
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Member Functions | List of all members
CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat Struct Reference

Use it instead of regular float for any cheating-sensitive variables. More...

Inheritance diagram for CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat:

Classes

struct  FloatIntBytesUnion
 

Public Member Functions

void ApplyNewCryptoKey ()
 Use it after SetNewCryptoKey() to re-encrypt current instance using new crypto key.
 
void RandomizeCryptoKey ()
 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.
 
int GetEncrypted ()
 Allows to pick current obscured value as is.
 
void SetEncrypted (int encrypted)
 Allows to explicitly set current obscured value. Crypto key should be same as when encrypted value was got with GetEncrypted().
 
float 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.
 

Static Public Member Functions

static void SetNewCryptoKey (int newKey)
 Allows to change default crypto key of this type instances. All new instances will use specified key.
All current instances will use previous key unless you call ApplyNewCryptoKey() on them explicitly.
 
static int Encrypt (float value)
 Use this simple encryption method to encrypt any float value, uses default crypto key.
 
static int Encrypt (float value, int key)
 Use this simple encryption method to encrypt any float value, uses passed crypto key.
 
static float Decrypt (int value)
 Use it to decrypt int you got from Encrypt(float) back to float, uses default crypto key.
 
static float Decrypt (int value, int key)
 Use it to decrypt int you got from Encrypt(float) back to float, uses passed crypto key.
 
static int MigrateEncrypted (int encrypted, byte fromVersion=0, byte toVersion=2)
 Allows to update the raw encrypted value to the newer encryption format.
 
static ObscuredFloat FromEncrypted (int encrypted)
 Creates and fills obscured variable with raw encrypted value previously got from GetEncrypted().
 

Detailed Description

Use it instead of regular float for any cheating-sensitive variables.

Regular type is faster and memory wiser comparing to the obscured one!

Member Function Documentation

◆ Decrypt()

static float CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.Decrypt ( int  value,
int  key 
)
inlinestatic

Use it to decrypt int you got from Encrypt(float) back to float, uses passed crypto key.

Make sure you're using key at least of 1000000000 value to improve security.

◆ Encrypt()

static int CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.Encrypt ( float  value,
int  key 
)
inlinestatic

Use this simple encryption method to encrypt any float value, uses passed crypto key.

Make sure you're using key at least of 1000000000 value to improve security.

◆ FromEncrypted()

static ObscuredFloat CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.FromEncrypted ( int  encrypted)
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.

Make sure this obscured type currently has same crypto key as when encrypted value was got with GetEncrypted(). It will be same (default) if you did not used SetNewCryptoKey().

Parameters
encryptedRaw encrypted value you got from GetEncrypted().
Returns
New obscured variable initialized from specified encrypted value.
See also
GetEncrypted(), SetEncrypted()

◆ GetDecrypted()

float CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.GetDecrypted ( )
inline

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.

◆ GetEncrypted()

int CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.GetEncrypted ( )
inline

Allows to pick current obscured value as is.

Use it in conjunction with SetEncrypted().
Useful for saving data in obscured state.

◆ MigrateEncrypted()

static int CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.MigrateEncrypted ( int  encrypted,
byte  fromVersion = 0,
byte  toVersion = 2 
)
inlinestatic

Allows to update the raw encrypted value to the newer encryption format.

Use when you have some encrypted values saved somewhere with previous ACTk version and you wish to set them using SetEncrypted() to the newer ACTk version obscured type. Current migration variants: from 0 or 1 to 2 - migrate obscured type from ACTk 1.5.2.0-1.5.8.0 to the 1.5.9.0+ format

Parameters
encryptedEncrypted value you got from previous ACTk version obscured type with GetEncrypted().
fromVersionSource format version.
toVersionTarget format version.
Returns
Migrated raw encrypted value which you may use for SetEncrypted(0 later.

◆ SetEncrypted()

void CodeStage.AntiCheat.ObscuredTypes.ObscuredFloat.SetEncrypted ( int  encrypted)
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()

The documentation for this struct was generated from the following file: