public void RandomizeCryptoKey()
        {
            Vector3 value = this.InternalDecrypt();

            this.currentCryptoKey = UnityEngine.Random.Range(-2147483648, 2147483647);
            this.hiddenValue      = ObscuredVector3.Encrypt(value, this.currentCryptoKey);
        }
 private ObscuredVector3(ObscuredVector3.RawEncryptedVector3 encrypted)
 {
     this.currentCryptoKey = ObscuredVector3.cryptoKey;
     this.hiddenValue      = encrypted;
     this.fakeValue        = ObscuredVector3.initialFakeValue;
     this.inited           = true;
 }
示例#3
0
        public void RandomizeCryptoKey()
        {
            Vector3 vector3 = this.InternalDecrypt();

            this.currentCryptoKey = Random.get_seed();
            this.hiddenValue      = ObscuredVector3.Encrypt(vector3, this.currentCryptoKey);
        }
 public void ApplyNewCryptoKey()
 {
     if (this.currentCryptoKey != ObscuredVector3.cryptoKey)
     {
         this.hiddenValue      = ObscuredVector3.Encrypt(this.InternalDecrypt(), ObscuredVector3.cryptoKey);
         this.currentCryptoKey = ObscuredVector3.cryptoKey;
     }
 }
 public void SetEncrypted(ObscuredVector3.RawEncryptedVector3 encrypted)
 {
     this.inited      = true;
     this.hiddenValue = encrypted;
     if (ObscuredCheatingDetector.IsRunning)
     {
         this.fakeValue = this.InternalDecrypt();
     }
 }
        public static Vector3 Decrypt(ObscuredVector3.RawEncryptedVector3 value, int key)
        {
            if (key == 0)
            {
                key = ObscuredVector3.cryptoKey;
            }
            Vector3 result;

            result.x = ObscuredFloat.Decrypt(value.x, key);
            result.y = ObscuredFloat.Decrypt(value.y, key);
            result.z = ObscuredFloat.Decrypt(value.z, key);
            return(result);
        }
示例#7
0
        public static Vector3 Decrypt(ObscuredVector3.RawEncryptedVector3 value, int key)
        {
            if (key == 0)
            {
                key = ObscuredVector3.cryptoKey;
            }
            Vector3 vector3;

            vector3.x = (__Null)(double)ObscuredFloat.Decrypt(value.x, key);
            vector3.y = (__Null)(double)ObscuredFloat.Decrypt(value.y, key);
            vector3.z = (__Null)(double)ObscuredFloat.Decrypt(value.z, key);
            return(vector3);
        }
        public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
        {
            SerializedProperty hiddenValue = prop.FindPropertyRelative("hiddenValue");
            SerializedProperty hiddenValueX = hiddenValue.FindPropertyRelative("x");
            SerializedProperty hiddenValueY = hiddenValue.FindPropertyRelative("y");
            SerializedProperty hiddenValueZ = hiddenValue.FindPropertyRelative("z");
            SetBoldIfValueOverridePrefab(prop, hiddenValue);

            SerializedProperty cryptoKey = prop.FindPropertyRelative("currentCryptoKey");
            SerializedProperty fakeValue = prop.FindPropertyRelative("fakeValue");
            SerializedProperty inited = prop.FindPropertyRelative("inited");

            int currentCryptoKey = cryptoKey.intValue;
            Vector3 val = Vector3.zero;

            if (!inited.boolValue)
            {
                if (currentCryptoKey == 0)
                {
                    currentCryptoKey = cryptoKey.intValue = ObscuredVector3.cryptoKeyEditor;
                }
                ObscuredVector3.RawEncryptedVector3 ev = ObscuredVector3.Encrypt(Vector3.zero, currentCryptoKey);
                hiddenValueX.intValue = ev.x;
                hiddenValueY.intValue = ev.y;
                hiddenValueZ.intValue = ev.z;
                inited.boolValue = true;
            }
            else
            {
                ObscuredVector3.RawEncryptedVector3 ev = new ObscuredVector3.RawEncryptedVector3();
                ev.x = hiddenValueX.intValue;
                ev.y = hiddenValueY.intValue;
                ev.z = hiddenValueZ.intValue;
                val = ObscuredVector3.Decrypt(ev, currentCryptoKey);
            }

            EditorGUI.BeginChangeCheck();
            val = EditorGUI.Vector3Field(position, label, val);
            if (EditorGUI.EndChangeCheck())
            {
                ObscuredVector3.RawEncryptedVector3 ev = ObscuredVector3.Encrypt(val, currentCryptoKey);
                hiddenValueX.intValue = ev.x;
                hiddenValueY.intValue = ev.y;
                hiddenValueZ.intValue = ev.z;
            }
            fakeValue.vector3Value = val;
            ResetBoldFont();
        }
        private Vector3 InternalDecrypt()
        {
            if (!this.inited)
            {
                this.currentCryptoKey = ObscuredVector3.cryptoKey;
                this.hiddenValue      = ObscuredVector3.Encrypt(ObscuredVector3.initialFakeValue, ObscuredVector3.cryptoKey);
                this.fakeValue        = ObscuredVector3.initialFakeValue;
                this.inited           = true;
            }
            Vector3 vector;

            vector.x = ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey);
            vector.y = ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey);
            vector.z = ObscuredFloat.Decrypt(this.hiddenValue.z, this.currentCryptoKey);
            if (ObscuredCheatingDetector.IsRunning && !this.fakeValue.Equals(Vector3.zero) && !this.CompareVectorsWithTolerance(vector, this.fakeValue))
            {
                ObscuredCheatingDetector.Instance.OnCheatingDetected();
            }
            return(vector);
        }
示例#10
0
        private Vector3 InternalDecrypt()
        {
            if (!this.inited)
            {
                this.currentCryptoKey = ObscuredVector3.cryptoKey;
                this.hiddenValue      = ObscuredVector3.Encrypt(ObscuredVector3.initialFakeValue, ObscuredVector3.cryptoKey);
                this.fakeValue        = ObscuredVector3.initialFakeValue;
                this.inited           = true;
            }
            Vector3 vector1;

            vector1.x = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey);
            vector1.y = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey);
            vector1.z = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.z, this.currentCryptoKey);
            // ISSUE: explicit reference operation
            if (ObscuredCheatingDetector.IsRunning && !((Vector3)@this.fakeValue).Equals((object)Vector3.get_zero()) && !this.CompareVectorsWithTolerance(vector1, this.fakeValue))
            {
                ObscuredCheatingDetector.Instance.OnCheatingDetected();
            }
            return(vector1);
        }
示例#11
0
 public static Vector3 Decrypt(ObscuredVector3.RawEncryptedVector3 value)
 {
     return(ObscuredVector3.Decrypt(value, 0));
 }