Encryption and Decryption in window form using c#.net 2005 witn MS-Access

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

using System.Security.Cryptography;

using System.IO;

 

namespace EncryptionDecryption

{

    public partial class Form1 : Form

    {

 

        string encrypted = "";

        string decrypted = "";

        byte[] b1;

        byte[] b2;

 

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

 

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            string original = textBox1.Text.Trim();

            string copy = textBox1.Text.Trim();

 

            // ***** Get HashCode of Original String ***** //

 

            int h = original.GetHashCode();

 

            // *****  Concat HashCode with Original String ***** //

 

            string withHash = original + h;

 

            // *****  Encryption ***** //

 

            b1 = Encoding.BigEndianUnicode.GetBytes(withHash);

            encrypted = Convert.ToBase64String(b1);

 

            // *****  Decryption ***** //

            b2 = Convert.FromBase64String(encrypted);

            original = Encoding.BigEndianUnicode.GetString(b2);

 

            // *****  Get Original String Back  ***** //

            original = original.Substring(0, copy.Length);

 

            textBox1.Clear();

        }

    }

}