Ejemplo n.º 1
0
        public void RandomizeCryptoKey()
        {
            Quaternion quaternion = this.InternalDecrypt();

            this.currentCryptoKey = Random.get_seed();
            this.hiddenValue      = ObscuredQuaternion.Encrypt(quaternion, this.currentCryptoKey);
        }
Ejemplo n.º 2
0
        /// <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 ObscuredQuaternion FromEncrypted(RawEncryptedQuaternion encrypted, int key)
        {
            var instance = new ObscuredQuaternion();

            instance.SetEncrypted(encrypted, key);
            return(instance);
        }
Ejemplo n.º 3
0
		public void ApplyNewCryptoKey()
		{
			if (this.currentCryptoKey != ObscuredQuaternion.cryptoKey)
			{
				this.hiddenValue = ObscuredQuaternion.Encrypt(this.InternalDecrypt(), ObscuredQuaternion.cryptoKey);
				this.currentCryptoKey = ObscuredQuaternion.cryptoKey;
			}
		}
Ejemplo n.º 4
0
		private Quaternion InternalDecrypt()
		{
			if (!this.inited)
			{
				this.currentCryptoKey = ObscuredQuaternion.cryptoKey;
				this.hiddenValue = ObscuredQuaternion.Encrypt(ObscuredQuaternion.initialFakeValue);
				this.fakeValue = ObscuredQuaternion.initialFakeValue;
				this.inited = true;
			}
			Quaternion quaternion;
			quaternion.x = ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey);
			quaternion.y = ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey);
			quaternion.z = ObscuredFloat.Decrypt(this.hiddenValue.z, this.currentCryptoKey);
			quaternion.w = ObscuredFloat.Decrypt(this.hiddenValue.w, this.currentCryptoKey);
			if (ObscuredCheatingDetector.IsRunning && !this.fakeValue.Equals(ObscuredQuaternion.initialFakeValue) && !this.CompareQuaternionsWithTolerance(quaternion, this.fakeValue))
			{
				ObscuredCheatingDetector.Instance.OnCheatingDetected();
			}
			return quaternion;
		}
Ejemplo n.º 5
0
        private Quaternion InternalDecrypt()
        {
            if (!this.inited)
            {
                this.currentCryptoKey = ObscuredQuaternion.cryptoKey;
                this.hiddenValue      = ObscuredQuaternion.Encrypt(ObscuredQuaternion.initialFakeValue);
                this.fakeValue        = ObscuredQuaternion.initialFakeValue;
                this.inited           = true;
            }
            Quaternion q1;

            q1.x = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.x, this.currentCryptoKey);
            q1.y = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.y, this.currentCryptoKey);
            q1.z = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.z, this.currentCryptoKey);
            q1.w = (__Null)(double)ObscuredFloat.Decrypt(this.hiddenValue.w, this.currentCryptoKey);
            // ISSUE: explicit reference operation
            if (ObscuredCheatingDetector.IsRunning && !((Quaternion)@this.fakeValue).Equals((object)ObscuredQuaternion.initialFakeValue) && !this.CompareQuaternionsWithTolerance(q1, this.fakeValue))
            {
                ObscuredCheatingDetector.Instance.OnCheatingDetected();
            }
            return(q1);
        }
Ejemplo n.º 6
0
 public static Quaternion Decrypt(ObscuredQuaternion.RawEncryptedQuaternion value)
 {
     return(ObscuredQuaternion.Decrypt(value, 0));
 }
Ejemplo n.º 7
0
 public static ObscuredQuaternion.RawEncryptedQuaternion Encrypt(Quaternion value)
 {
     return(ObscuredQuaternion.Encrypt(value, 0));
 }
Ejemplo n.º 8
0
		public void RandomizeCryptoKey()
		{
			Quaternion value = this.InternalDecrypt();
			this.currentCryptoKey = UnityEngine.Random.Range(-2147483648, 2147483647);
			this.hiddenValue = ObscuredQuaternion.Encrypt(value, this.currentCryptoKey);
		}