/// <summary> /// Creates and fills obscured variable with raw encrypted value previously got from GetEncrypted(). /// </summary> /// 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. /// /// <param name="encrypted">Raw encrypted value you got from GetEncrypted().</param> /// <param name="key">Encryption key you've got from GetEncrypted().</param> /// <returns>New obscured variable initialized from specified encrypted value.</returns> /// \sa GetEncrypted(), SetEncrypted() public static ObscuredVector2 FromEncrypted(RawEncryptedVector2 encrypted, int key) { var instance = new ObscuredVector2(); instance.SetEncrypted(encrypted, key); return(instance); }
public void RandomizeCryptoKey() { Vector2 value = this.InternalDecrypt(); this.currentCryptoKey = UnityEngine.Random.Range(-2147483648, 2147483647); this.hiddenValue = ObscuredVector2.Encrypt(value, this.currentCryptoKey); }
public void RandomizeCryptoKey() { Vector2 vector2 = this.InternalDecrypt(); this.currentCryptoKey = Random.get_seed(); this.hiddenValue = ObscuredVector2.Encrypt(vector2, this.currentCryptoKey); }
public void ApplyNewCryptoKey() { if (this.currentCryptoKey != ObscuredVector2.cryptoKey) { this.hiddenValue = ObscuredVector2.Encrypt(this.InternalDecrypt(), ObscuredVector2.cryptoKey); this.currentCryptoKey = ObscuredVector2.cryptoKey; } }
private Vector2 InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredVector2.cryptoKey; this.hiddenValue = ObscuredVector2.Encrypt(ObscuredVector2.initialFakeValue); this.fakeValue = ObscuredVector2.initialFakeValue; this.inited = true; } Vector2 vector; vector.x = ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey); vector.y = ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey); if (ObscuredCheatingDetector.IsRunning && !this.fakeValue.Equals(ObscuredVector2.initialFakeValue) && !this.CompareVectorsWithTolerance(vector, this.fakeValue)) { ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(vector); }
private Vector2 InternalDecrypt() { if (!this.inited) { this.currentCryptoKey = ObscuredVector2.cryptoKey; this.hiddenValue = ObscuredVector2.Encrypt(ObscuredVector2.initialFakeValue); this.fakeValue = ObscuredVector2.initialFakeValue; this.inited = true; } Vector2 vector1; vector1.x = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey); vector1.y = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey); // ISSUE: explicit reference operation if (ObscuredCheatingDetector.IsRunning && !((Vector2)@this.fakeValue).Equals((object)ObscuredVector2.initialFakeValue) && !this.CompareVectorsWithTolerance(vector1, this.fakeValue)) { ObscuredCheatingDetector.Instance.OnCheatingDetected(); } return(vector1); }
public static Vector2 Decrypt(ObscuredVector2.RawEncryptedVector2 value) { return(ObscuredVector2.Decrypt(value, 0)); }
public static ObscuredVector2.RawEncryptedVector2 Encrypt(Vector2 value) { return(ObscuredVector2.Encrypt(value, 0)); }