Ejemplo n.º 1
0
        private void btnGiaiMa_Click(object sender, EventArgs e)
        {
            if (txtGMBanMa.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập bản rõ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (txtGMKhoa.Text == "")
            {
                MessageBox.Show("Key không được để trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                int z = Int32.Parse(txtGMKhoa.Text);
            }
            catch
            {
                MessageBox.Show("Key phải là số nguyên", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            txtGMBanRo.Text = Ceasar.decrypt(txtGMBanMa.Text, Int32.Parse(txtGMKhoa.Text));
            //MessageBox.Show("Giải mã thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 2
0
        private void btnGMThamMa_Click(object sender, EventArgs e)
        {
            if (txtGMBanMa.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập bản rõ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            txtGMBanRo.Text = Ceasar.decrypt(txtGMBanMa.Text);
        }