Post: [Idea] Cryptography Program (Is it possible?)
11-09-2013, 10:20 AM #1
Dan
I'm a god.
(adsbygoogle = window.adsbygoogle || []).push({}); Today I started to look into Cryptography, now before we go on, if you don't know the correct meaning of Cryptography please take the time to read up on it. Now back to what we're looking at, I was wondering if you could make a program that converts text to different encryptions (I.E. The Caesar Cipher, The Polyalphabetic Cipher, The One Time Pad, etc.). I've made the UI so you guys/gals can get an idea of what I mean, but the down side to this is a program that can decrypt the message would have to be made. Though it shouldn't be that hard since you'd have the key?

You must login or register to view this content.

The dropdown:
You must login or register to view this content.
Last edited by Dan ; 11-09-2013 at 10:32 AM.

The following user groaned Dan for this awful post:

Bruno
11-09-2013, 04:09 PM #2
spudeeelad
I defeated!
Originally posted by Shadow View Post
Today I started to look into Cryptography, now before we go on, if you don't know the correct meaning of Cryptography please take the time to read up on it. Now back to what we're looking at, I was wondering if you could make a program that converts text to different encryptions (I.E. The Caesar Cipher, The Polyalphabetic Cipher, The One Time Pad, etc.). I've made the UI so you guys/gals can get an idea of what I mean, but the down side to this is a program that can decrypt the message would have to be made. Though it shouldn't be that hard since you'd have the key?

You must login or register to view this content.

The dropdown:
You must login or register to view this content.

I already have one of these using my own algorithm. I mostly use it for encrypting app settings and connection strings inside app.config.

However, the way I did this was to store the key inside the app and obfuscate the application.

Basically, I paste a string into a textbox (encrypted or unencrypted), then click a button whether I want to decrypt or encrypt.
11-09-2013, 09:14 PM #3
Dan
I'm a god.
Originally posted by spudeeelad View Post
snip


So from my understanding, your program just uses one encryption type, but mine would support multiple ones. So on a 1-10 basis how hard would this be?
11-10-2013, 12:25 PM #4
spudeeelad
I defeated!
Originally posted by Shadow View Post
So from my understanding, your program just uses one encryption type, but mine would support multiple ones. So on a 1-10 basis how hard would this be?

Not that hard I would imagine. Like;
    
private void button1_Click (eventargs e)
if (combobox1.SelectedIndex == 0)
{
encryption method 1
}

if (combobox1.SelectedIndex == 1)
{
encryption method 2
}

if (combobox1.SelectedIndex == 2)
{
encryption method 3
}
11-10-2013, 02:22 PM #5
Originally posted by spudeeelad View Post
Not that hard I would imagine. Like;
    
private void button1_Click (eventargs e)
if (combobox1.SelectedIndex == 0)
{
encryption method 1
}

if (combobox1.SelectedIndex == 1)
{
encryption method 2
}

if (combobox1.SelectedIndex == 2)
{
encryption method 3
}


Erm or... Switch case system?

    
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (comboBox1.SelectedIndex)
{
case 0:
// encryption method 1
break;
case 1:
// encryption method 2
break;
case 2:
// encryption method 3
break;
}
}


also... needs to be else if not just if statements

    
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 0)
{
// encryption method 1
}
else if (comboBox1.SelectedIndex == 1)
{
// encryption method 2
}
else if (comboBox1.SelectedIndex == 2)
{
// encryption method 3
}
}
11-10-2013, 05:29 PM #6
Master Ro
I make food
Originally posted by Shadow View Post
Today I started to look into Cryptography, now before we go on, if you don't know the correct meaning of Cryptography please take the time to read up on it. Now back to what we're looking at, I was wondering if you could make a program that converts text to different encryptions (I.E. The Caesar Cipher, The Polyalphabetic Cipher, The One Time Pad, etc.). I've made the UI so you guys/gals can get an idea of what I mean, but the down side to this is a program that can decrypt the message would have to be made. Though it shouldn't be that hard since you'd have the key?

You must login or register to view this content.

The dropdown:
You must login or register to view this content.



Of course this is possible. Not only is it possible, it's extremely simple (assuming you're not writing the encryption algorithms yourself. You'd probably have to do alot of research in that case).

The following user thanked Master Ro for this useful post:

Dan
11-10-2013, 05:48 PM #7
SNMT| Havoc
Do a barrel roll!
     
private void btnEncrypt(object sender, EventArgs e)
{
if (cmbEncrypt.SelectedIndex == 0)
{
//Caesar Cipher method
}
else if (cmbEncrypt.SelectedIndex == 1)
{
//Polyalphabetic Cipher method
}
else if (cmbEncrypt.SelectedIndex == 2)
{
//One Time Pad method
}
}

The following user thanked SNMT| Havoc for this useful post:

Dan
11-10-2013, 05:59 PM #8
Dan
I'm a god.
Originally posted by Master
Of course this is possible. Not only is it possible, it's extremely simple (assuming you're not writing the encryption algorithms yourself. You'd probably have to do alot of research in that case).


Though when the user needs to decrypt, would that be easy to program too?
11-10-2013, 07:38 PM #9
Master Ro
I make food
Originally posted by Shadow View Post
Though when the user needs to decrypt, would that be easy to program too?


If you have the encryption key, then yes.

The following user thanked Master Ro for this useful post:

Dan
11-11-2013, 04:18 PM #10
spudeeelad
I defeated!
Originally posted by TheUnexpected View Post
Erm or... Switch case system?

    
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
switch (comboBox1.SelectedIndex)
{
case 0:
// encryption method 1
break;
case 1:
// encryption method 2
break;
case 2:
// encryption method 3
break;
}
}


also... needs to be else if not just if statements

    
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 0)
{
// encryption method 1
}
else if (comboBox1.SelectedIndex == 1)
{
// encryption method 2
}
else if (comboBox1.SelectedIndex == 2)
{
// encryption method 3
}
}

I wasn't writing to be precise or give a working code.

However, personally, I never use case unless I have more than 5 if statements (general rule I use) as there isn't much difference performance wise unless you have a significant amount of ifs.

I also never use else if. I prefer;
    
if()
{
}

if()
{
}

if()
{
}

if()
{
}

else
{
}


But you're not wrong. It just depends on your individual way of writing.

The following user thanked spudeeelad for this useful post:

Complete Speed

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo