Computer Science Canada Encryption |
Author: | Prince Pwn [ Tue Jun 15, 2010 6:24 am ] | ||
Post subject: | Encryption | ||
Program I made for my algorithms class a few months ago:
|
Author: | Cezna [ Tue Jun 15, 2010 2:07 pm ] |
Post subject: | RE:Encryption |
Nice looking interface, I love it this kind of style. I was looking through it and don't have the patience, attention span or likely the skill necessary to understand how it works. Mind briefly explaining it (just enough to give me an idea so that I can read through the code with this information in mind and be able to understand it). |
Author: | USEC_OFFICER [ Tue Jun 15, 2010 2:43 pm ] |
Post subject: | RE:Encryption |
It looks like a Caesar shift to me. Though it could just be random letters instead. |
Author: | Cezna [ Tue Jun 15, 2010 3:26 pm ] |
Post subject: | RE:Encryption |
Isn't that when the numerical value of a letter is shifter a given number of values in one direction? I doubt that, as I looked at the key, and it is so large that the letters would be way out of range. Unless the first number in the key is the ammount to shift the first letter, the second number in the key the ammount to shift the second letter, and so on (and then it repeats after reaching the last number in the key). |
Author: | chrisbrown [ Tue Jun 15, 2010 3:54 pm ] |
Post subject: | Re: RE:Encryption |
Cezna @ Tue Jun 15, 2010 3:26 pm wrote: Isn't that when the numerical value of a letter is shifter a given number of values in one direction? Yep.
Cezna @ Tue Jun 15, 2010 3:26 pm wrote: I doubt that, as I looked at the key, and it is so large that the letters would be way out of range. Easily solved with the mod function.
From the looks of it, he's generating an alphabet in random order, then replacing each letter with its randomized positional equivalent. In this case, the key is actually used as a random number seed. Normally, Rand.Int returns an unpredictable number each time, but if you set a seed with Rand.Set, it will generate the same sequence every time. |
Author: | Cezna [ Tue Jun 15, 2010 4:06 pm ] |
Post subject: | Re: RE:Encryption |
Cezna @ Tue Jun 15, 2010 3:26 pm wrote: I doubt that, as I looked at the key, and it is so large that the letters would be way out of range. Easily solved with the mod function.[/quote]
But if you were going to use mod, why have a key that is like 10 digits long? Cezna @ Tue Jun 15, 2010 3:26 pm wrote: In this case, the key is actually used as a random number seed. Normally, Rand.Int returns an unpredictable number each time, but if you set a seed with Rand.Set, it will generate the same sequence every time.
And if you are having it generate the same sequence every time, what is the prupose of it being random (or do you eman each time until the program is closed and rerun?) I guess I should probably understand Rand.Set a little better before I go commenting on it |
Author: | USEC_OFFICER [ Tue Jun 15, 2010 5:17 pm ] |
Post subject: | Re: RE:Encryption |
Cezna @ Tue Jun 15, 2010 5:06 pm wrote: But if you were going to use mod, why have a key that is like 10 digits long? To make it more secure? |
Author: | Cezna [ Tue Jun 15, 2010 5:39 pm ] |
Post subject: | RE:Encryption |
Maybe, but it is all open source, and you can ask it what the key is and decrypt encrypted messages. Wouldn't make sense to go to such lengths to hide the key and then do all that. |
Author: | chrisbrown [ Tue Jun 15, 2010 5:48 pm ] | ||
Post subject: | Re: RE:Encryption | ||
USEC_OFFICER @ Tue Jun 15, 2010 5:17 pm wrote: Cezna @ Tue Jun 15, 2010 5:06 pm wrote: But if you were going to use mod, why have a key that is like 10 digits long? Reducing modulo the number of printable characters means you have around 100 possible shift values. Whether you have 1 digit or a million, there is nothing secure about a ceasar cipher. And in this case, a large key simply means it isn't likely to be duplicated. A key of "1" will give the same type of results as any other integer when used as a random seed, it's just harder to guess a big one. Cezna @ Tue Jun 15, 2010 5:06 pm wrote: If you are having it generate the same sequence every time, what is the prupose of it being random (or do you mean each time until the program is closed and rerun?)
If you know the seed when encrypting, by seeding the same value later on, you can generate the same "random" alphabet to decrypt with. Turing generates a random seed automatically when execution starts. Run this a few times and compare what changes.
|
Author: | DtY [ Tue Jun 15, 2010 7:54 pm ] |
Post subject: | Re: RE:Encryption |
chrisbrown @ Tue Jun 15, 2010 5:48 pm wrote: USEC_OFFICER @ Tue Jun 15, 2010 5:17 pm wrote: Cezna @ Tue Jun 15, 2010 5:06 pm wrote: But if you were going to use mod, why have a key that is like 10 digits long? Reducing modulo the number of printable characters means you have around 100 possible shift values. Whether you have 1 digit or a million, there is nothing secure about a ceasar cipher. And in this case, a large key simply means it isn't likely to be duplicated. A key of "1" will give the same type of results as any other integer when used as a random seed, it's just harder to guess a big one. No, because of how few keys there are for a caeser shift, if you are working with n numbers, whatever key you choose, say k, will be the same key as k mod n, that is, if you have 26 characters, and you choose the key 27, it is the same key as 1. Picking a large key for a caeser shift wont make it more secure. |
Author: | chrisbrown [ Tue Jun 15, 2010 8:09 pm ] |
Post subject: | Re: RE:Encryption |
chrisbrown wrote: Reducing modulo the number of printable characters means you have around 100 possible shift values. Whether you have 1 digit or a million, there is nothing secure about a ceasar cipher.
And in this case, a large key simply means it isn't likely to be duplicated. A key of "1" will give the same type of results as any other integer when used as a random seed, it's just harder to guess a big one. DtY @ Tue Jun 15, 2010 7:54 pm wrote: No, because of how few keys there are for a caeser shift, if you are working with n numbers, whatever key you choose, say k, will be the same key as k mod n, that is, if you have 26 characters, and you choose the key 27, it is the same key as 1. Picking a large key for a caeser shift wont make it more secure.
Sorry, I wasn't very clear. That's what I was trying to say in the first part; in the second, that - with respect to OP's program - Rand.Seed (1) will encrypt just as well as Rand.Seed(1087590873), but the second is much harder to guess. |
Author: | Prince Pwn [ Wed Apr 13, 2011 9:14 am ] | ||
Post subject: | Re: Encryption | ||
Updated code. Changelog: - Password protected key - Program stores encryption key in a separate, unencrypted file - Minor GUI changes
|