Need a poor man's encryption

Need a poor man's encryption

I have used AES (or is it EAS?) in my C# WinForms program. BUt for this aplication I was thinkg about something smaller and made up of small number of lines of code. It's not something that needs to be very secure. But I woud like it to be not usable as is.

Are there any simple algorithms that scramble and rename characters to otherwise make a mess out of a string?

This is for C#.

Thanks,
newbieweb
newbiewebSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sam_gibsonCommented:
How about using a MD5 hash, if you can get away with one-way encryption?
0
newbiewebSr. Software EngineerAuthor Commented:
What's MD5 hash? Is there C# available for that?
0
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
For simple string "encryption" you can just use Convert.ToBase64String():
        private void button1_Click(object sender, EventArgs e)
        {
            string str1 = textBox1.Text;

            // encrypt the string
            string str2 = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(str1));

            label1.Text = str2; // the "encrypted" string

            // convert it back
            string str3 = ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(str2));

            label2.Text = str3; // the "decrypted" string
        }

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
priyank_gajeraCommented:
I am writing one function this works perfectly for me.
Please let me know is this helps or You need any other method.

public static string Encrypt(String plainText)
        {
            string encrypted = null;
            try
            {
                byte[] inputBytes = ASCIIEncoding.ASCII.GetBytes(plainText);
                byte[] pwdhash = null;
                MD5CryptoServiceProvider hashmd5;

                //generate an MD5 hash from the password. 
                //a hash is a one way encryption meaning once you generate
                //the hash, you cant derive the password back from it.
                hashmd5 = new MD5CryptoServiceProvider();
                pwdhash = hashmd5.ComputeHash(ASCIIEncoding.ASCII.GetBytes(key));
                hashmd5 = null;

                // Create a new TripleDES service provider 
                TripleDESCryptoServiceProvider tdesProvider = new TripleDESCryptoServiceProvider();
                tdesProvider.Key = pwdhash;
                tdesProvider.Mode = CipherMode.ECB;

                encrypted = Convert.ToBase64String(
                    tdesProvider.CreateEncryptor().TransformFinalBlock(inputBytes, 0, inputBytes.Length));
            }
            catch (Exception e)
            {
                string str = e.Message;
                throw;
            }
            return encrypted;
        }

Open in new window

0
Rich RumbleSecurity SamuraiCommented:
No Rot-13 suggestion yet ;p http://dotnetperls.com/rot13 Much simpler in non-compiled languages, typically 1-3 lines of code... Here's TwoFish as well: http://www.schneier.com/twofish-download.html
-rich

0
newbiewebSr. Software EngineerAuthor Commented:
thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.