Exemplo n.º 1
0
        protected void encryptBtn_Click(object sender, EventArgs e)
        {
            //get the users data and pin code input
            String pass     = passText.Text;
            String passname = passName.Text;
            String pin      = pinText.Text;

            //server side input validation
            if (passname.Length < 1)
            {
                Label2.ForeColor = System.Drawing.Color.Red;
                Label2.Text      = "Please Enter a Password Name";
                return;
            }
            if (pass.Length < 1)
            {
                Label2.ForeColor = System.Drawing.Color.Red;
                Label2.Text      = "Please Enter a Password";
                return;
            }
            if (pin.Length < 1)
            {
                Label2.ForeColor = System.Drawing.Color.Red;
                Label2.Text      = "Please Enter a Pin Code";
                return;
            }

            //hash the user inputted pincode
            String key = Bouncy.Hash(pin);
            //get instance of AESCipher internal class
            AESCipher AESCipher = new AESCipher();

            //generate a 16 byte random IV
            byte[] ivBytes = AESCipher.GenerateRandomIV(16);
            //convert IV to string
            String iv = Convert.ToBase64String(ivBytes);
            //encrypt the password using the pin code and the IV
            String encrypted = AESCipher.encrypt(pass, key, iv);

            Debug.WriteLine("encrypted text..................................." + encrypted);

            //set the encrypted password and hashed pin code on screen
            passText.Text = encrypted;
            pinText.Text  = key;
        }
Exemplo n.º 2
0
 public override void Create()
 {
     this.bouncy = new Bouncy(0.25f, 0.025f);
     return;
 }
Exemplo n.º 3
0
 public static void BouncyHit(Bouncy bounce)
 {
     score += bounce.points * multi[i];
 }
Exemplo n.º 4
0
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        bool hitGround = Vector3.Dot(hit.normal, Vector3.up) > 0.5f;

        //don't collide with the ground
        if (hitGround)
        {
            return;
        }

        if (hit.gameObject.CompareTag("Player"))
        {
            //hitting a player
            Player otherPlayer = hit.gameObject.GetComponent <Player>();
            if (otherPlayer == null)
            {
                Kill();
                return;
            }

            otherPlayer.Hit(damage);
            if (damage > 20)
            {
                Screenshake.current.Shake(0.5f, 0.1f);
            }
            if (size > 2)
            {
                GridDistortion.current.Distort(team.distortionIndex, hit.transform.position, size - 2);
                GridDistortion.current.Expand(team.distortionIndex, (size - 2) * -10, 250);

                if (particles)
                {
                    (Instantiate(particles, hit.transform.position, Quaternion.identity) as HitParticles).InitSystem(team.team, (int)(Mathf.Pow(size, 2.5f) * 2));
                }
            }
            Kill();
        }
        else if (hit.gameObject.CompareTag("Bullet"))
        {
            //hitting another bullet
            Bullet otherBullet = hit.gameObject.GetComponent <Bullet>();
            if (otherBullet == null)
            {
                Kill();
                return;
            }

            if (otherBullet.damage > damage + 0.25f)
            {
                Kill();
            }
            else if (otherBullet.damage < damage - 0.25f)
            {
                otherBullet.Kill();
            }
            else
            {
                otherBullet.Kill();
                Kill();
            }
        }
        else if (hit.gameObject.CompareTag("Bouncy"))
        {
            Vector3 flatnormal = hit.normal;
            flatnormal.y = 0;
            direction    = Vector3.Reflect(direction, flatnormal);

            //tell the bounce object that it was collided with
            Bouncy bounce = hit.gameObject.GetComponent <Bouncy>();
            if (bounce)
            {
                bounce.Bounce();
            }
        }
        else
        {
            Kill();
        }
    }